Исправления №1
This commit is contained in:
parent
1d2926e90d
commit
0570b9089c
@ -1,7 +1,5 @@
|
||||
using SishiBarBusinessLogic.OfficePackage.HelperModels;
|
||||
using SushiBarBusinessLogic.OfficePackage.HelperEnums;
|
||||
using SushiBarBusinessLogic.OfficePackage.HelperEnums;
|
||||
using SushiBarBusinessLogic.OfficePackage.HelperModels;
|
||||
using SushiBarpBusinessLogic.OfficePackage.HelperModels;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
namespace SushiBarBusinessLogic.OfficePackage
|
||||
|
@ -1,6 +1,6 @@
|
||||
using SushiBarContracts.ViewModels;
|
||||
|
||||
namespace SishiBarBusinessLogic.OfficePackage.HelperModels
|
||||
namespace SushiBarBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class PdfInfo
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
using SushiBarBusinessLogic.OfficePackage.HelperEnums;
|
||||
namespace SushiBarpBusinessLogic.OfficePackage.HelperModels
|
||||
namespace SushiBarBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class PdfParagraph
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
using SushiBarBusinessLogic.OfficePackage;
|
||||
|
||||
using SushiBarBusinessLogic.OfficePackage;
|
||||
using SushiBarBusinessLogic.OfficePackage.HelperModels;
|
||||
using SushiBarContracts.BindingModels;
|
||||
using SushiBarContracts.BusinessLogicsContracts;
|
||||
|
@ -6,7 +6,6 @@ using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
using SushiBarBusinessLogic.OfficePackage.HelperEnums;
|
||||
using SushiBarBusinessLogic.OfficePackage.HelperModels;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace SushiBarBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
@ -228,12 +227,10 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
|
||||
var worksheetPart = workbookpart.AddNewPart<WorksheetPart>();
|
||||
worksheetPart.Worksheet = new Worksheet(new SheetData());
|
||||
// Добавляем лист в книгу
|
||||
var sheets =
|
||||
_spreadsheetDocument.WorkbookPart.Workbook.AppendChild(new Sheets());
|
||||
var sheets = _spreadsheetDocument.WorkbookPart.Workbook.AppendChild(new Sheets());
|
||||
var sheet = new Sheet()
|
||||
{
|
||||
Id =
|
||||
_spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart),
|
||||
Id = _spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart),
|
||||
SheetId = 1,
|
||||
Name = "Лист"
|
||||
};
|
||||
@ -253,11 +250,9 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
|
||||
}
|
||||
// Ищем строку, либо добавляем ее
|
||||
Row row;
|
||||
if (sheetData.Elements<Row>().Where(r => r.RowIndex! ==
|
||||
excelParams.RowIndex).Any())
|
||||
if (sheetData.Elements<Row>().Where(r => r.RowIndex! == excelParams.RowIndex).Any())
|
||||
{
|
||||
row = sheetData.Elements<Row>().Where(r => r.RowIndex! ==
|
||||
excelParams.RowIndex).First();
|
||||
row = sheetData.Elements<Row>().Where(r => r.RowIndex! == excelParams.RowIndex).First();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -267,8 +262,7 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
|
||||
// Ищем нужную ячейку
|
||||
Cell cell; if (row.Elements<Cell>().Where(c => c.CellReference!.Value == excelParams.CellReference).Any())
|
||||
{
|
||||
cell = row.Elements<Cell>().Where(c => c.CellReference!.Value ==
|
||||
excelParams.CellReference).First();
|
||||
cell = row.Elements<Cell>().Where(c => c.CellReference!.Value == excelParams.CellReference).First();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -277,8 +271,7 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
|
||||
Cell? refCell = null;
|
||||
foreach (Cell rowCell in row.Elements<Cell>())
|
||||
{
|
||||
if (string.Compare(rowCell.CellReference!.Value,
|
||||
excelParams.CellReference, true) > 0)
|
||||
if (string.Compare(rowCell.CellReference!.Value, excelParams.CellReference, true) > 0)
|
||||
{
|
||||
refCell = rowCell;
|
||||
break;
|
||||
@ -286,19 +279,15 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
|
||||
}
|
||||
var newCell = new Cell()
|
||||
{
|
||||
CellReference =
|
||||
excelParams.CellReference
|
||||
CellReference = excelParams.CellReference
|
||||
};
|
||||
row.InsertBefore(newCell, refCell);
|
||||
cell = newCell;
|
||||
}
|
||||
// вставляем новый текст
|
||||
_shareStringPart.SharedStringTable.AppendChild(new
|
||||
SharedStringItem(new Text(excelParams.Text)));
|
||||
_shareStringPart.SharedStringTable.AppendChild(new SharedStringItem(new Text(excelParams.Text)));
|
||||
_shareStringPart.SharedStringTable.Save();
|
||||
cell.CellValue = new
|
||||
CellValue((_shareStringPart.SharedStringTable.Elements<SharedStringItem>().Count(
|
||||
) - 1).ToString());
|
||||
cell.CellValue = new CellValue((_shareStringPart.SharedStringTable.Elements<SharedStringItem>().Count() - 1).ToString());
|
||||
cell.DataType = new EnumValue<CellValues>(CellValues.SharedString);
|
||||
cell.StyleIndex = GetStyleValue(excelParams.StyleInfo);
|
||||
}
|
||||
@ -339,7 +328,7 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
|
||||
return;
|
||||
}
|
||||
_spreadsheetDocument.WorkbookPart!.Workbook.Save();
|
||||
_spreadsheetDocument.Close();
|
||||
_spreadsheetDocument.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
@ -2,11 +2,8 @@
|
||||
using MigraDoc.DocumentObjectModel;
|
||||
using MigraDoc.DocumentObjectModel.Tables;
|
||||
using MigraDoc.Rendering;
|
||||
using SishiBarBusinessLogic.OfficePackage.HelperModels;
|
||||
using SushiBarBusinessLogic.OfficePackage;
|
||||
using SushiBarBusinessLogic.OfficePackage.HelperEnums;
|
||||
using SushiBarBusinessLogic.OfficePackage.HelperModels;
|
||||
using SushiBarpBusinessLogic.OfficePackage.HelperModels;
|
||||
namespace SushiBarBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
public class SaveToPdf : AbstractSaveToPdf
|
||||
@ -51,8 +48,7 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
|
||||
}
|
||||
var paragraph = _section.AddParagraph(pdfParagraph.Text);
|
||||
paragraph.Format.SpaceAfter = "1cm";
|
||||
paragraph.Format.Alignment =
|
||||
GetParagraphAlignment(pdfParagraph.ParagraphAlignment);
|
||||
paragraph.Format.Alignment = GetParagraphAlignment(pdfParagraph.ParagraphAlignment);
|
||||
paragraph.Style = pdfParagraph.Style;
|
||||
}
|
||||
protected override void CreateTable(List<string> columns)
|
||||
|
@ -1,7 +1,5 @@
|
||||
using SushiBarBusinessLogic.OfficePackage.HelperEnums;
|
||||
using SushiBarBusinessLogic.OfficePackage.HelperModels;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
using System.Reflection.Metadata;
|
||||
using DocumentFormat.OpenXml;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
@ -117,7 +115,7 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
|
||||
}
|
||||
_docBody.AppendChild(CreateSectionProperties());
|
||||
_wordDocument.MainDocumentPart!.Document.Save();
|
||||
_wordDocument.Close();
|
||||
_wordDocument.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user