Compare commits
No commits in common. "f85875077658609b828e0b3fb2adcdceb923419f" and "9acf87b21282abf14ecaca7b144752df70ad9989" have entirely different histories.
f858750776
...
9acf87b212
@ -10,7 +10,6 @@ using System.Windows.Forms;
|
||||
using RenovationWorkContracts.BindingModels;
|
||||
using RenovationWorkContracts.BusinessLogicsContracts;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using RenovationWorkBusinessLogic.BusinessLogics;
|
||||
|
||||
namespace RenovationWorkView
|
||||
{
|
||||
|
@ -31,8 +31,6 @@
|
||||
panel = new Panel();
|
||||
buttonToPdf = new Button();
|
||||
buttonMake = new Button();
|
||||
labelTo = new Label();
|
||||
labelFrom = new Label();
|
||||
dateTimePickerTo = new DateTimePicker();
|
||||
dateTimePickerFrom = new DateTimePicker();
|
||||
labelTo = new Label();
|
||||
@ -44,8 +42,6 @@
|
||||
//
|
||||
panel.Controls.Add(buttonToPdf);
|
||||
panel.Controls.Add(buttonMake);
|
||||
panel.Controls.Add(labelTo);
|
||||
panel.Controls.Add(labelFrom);
|
||||
panel.Controls.Add(dateTimePickerTo);
|
||||
panel.Controls.Add(dateTimePickerFrom);
|
||||
panel.Controls.Add(labelTo);
|
||||
@ -108,20 +104,6 @@
|
||||
labelFrom.TabIndex = 0;
|
||||
labelFrom.Text = "С";
|
||||
//
|
||||
// dateTimePickerTo
|
||||
//
|
||||
dateTimePickerTo.Location = new Point(264, 6);
|
||||
dateTimePickerTo.Name = "dateTimePickerTo";
|
||||
dateTimePickerTo.Size = new Size(200, 23);
|
||||
dateTimePickerTo.TabIndex = 1;
|
||||
//
|
||||
// dateTimePickerFrom
|
||||
//
|
||||
dateTimePickerFrom.Location = new Point(31, 5);
|
||||
dateTimePickerFrom.Name = "dateTimePickerFrom";
|
||||
dateTimePickerFrom.Size = new Size(200, 23);
|
||||
dateTimePickerFrom.TabIndex = 0;
|
||||
//
|
||||
// FormReportOrders
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
@ -144,6 +126,5 @@
|
||||
private Button buttonToPdf;
|
||||
private Button buttonMake;
|
||||
private DateTimePicker dateTimePickerTo;
|
||||
private DateTimePicker dateTimePickerFrom;
|
||||
}
|
||||
}
|
@ -11,11 +11,6 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using RenovationWorkContracts.BindingModels;
|
||||
using RenovationWorkContracts.BusinessLogicsContracts;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Reporting.WinForms;
|
||||
|
||||
|
||||
namespace RenovationWorkView
|
||||
{
|
||||
@ -103,4 +98,3 @@ namespace RenovationWorkView
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,9 +10,6 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using RenovationWorkContracts.BindingModels;
|
||||
using RenovationWorkContracts.BusinessLogicsContracts;
|
||||
|
||||
namespace RenovationWorkView
|
||||
{
|
||||
|
@ -1,6 +1,4 @@
|
||||
using RenovationWorkBusinessLogic.BusinessLogics;
|
||||
using RenovationWorkBusinessLogic.OfficePackage.Implements;
|
||||
using RenovationWorkBusinessLogic.OfficePackage;
|
||||
using RenovationWorkContracts.BusinessLogicsContracts;
|
||||
using RenovationWorkContracts.StoragesContracts;
|
||||
using RenovationWorkDatabaseImplement.Implements;
|
||||
|
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file is automatically generated by Visual Studio .Net. It is
|
||||
used to store generic object data source configuration information.
|
||||
Renaming the file extension or editing the content of this file may
|
||||
cause the file to be unrecognizable by the program.
|
||||
-->
|
||||
<GenericObjectDataSource DisplayName="IComponentLogic" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>RenovationWorkContracts.BusinessLogicsContracts.IComponentLogic, RenovationWorkContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
</GenericObjectDataSource>
|
@ -16,7 +16,6 @@
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
|
||||
<PackageReference Include="MigraDocCore.Rendering" Version="1.3.63" />
|
||||
<PackageReference Include="NLog" Version="5.2.8" />
|
||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
|
||||
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
|
||||
@ -47,10 +46,4 @@
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="ReportOrders.rdlc">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
File diff suppressed because it is too large
Load Diff
@ -21,14 +21,12 @@ namespace RenovationWorkBusinessLogic.BusinessLogics
|
||||
private readonly AbstractSaveToExcel _saveToExcel;
|
||||
private readonly AbstractSaveToWord _saveToWord;
|
||||
private readonly AbstractSaveToPdf _saveToPdf;
|
||||
|
||||
public ReportLogic(IRepairStorage repairStorage, IComponentStorage componentStorage, IOrderStorage orderStorage,
|
||||
AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
|
||||
AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
|
||||
{
|
||||
_repairStorage = repairStorage;
|
||||
_componentStorage = componentStorage;
|
||||
_orderStorage = orderStorage;
|
||||
|
||||
_saveToExcel = saveToExcel;
|
||||
_saveToWord = saveToWord;
|
||||
_saveToPdf = saveToPdf;
|
||||
@ -42,24 +40,22 @@ namespace RenovationWorkBusinessLogic.BusinessLogics
|
||||
TotalCount = x.RepairComponents.Select(x => x.Value.Item2).Sum()
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public List<ReportOrdersViewModel> GetOrders(ReportBindingModel model)
|
||||
{
|
||||
return _orderStorage.GetFilteredList(new OrderSearchModel
|
||||
{
|
||||
{
|
||||
DateFrom = model.DateFrom,
|
||||
DateTo = model.DateTo
|
||||
}).Select(x => new ReportOrdersViewModel
|
||||
{
|
||||
Id = x.Id,
|
||||
DateCreate = x.DateCreate,
|
||||
RepairName = x.RepairName,
|
||||
Sum = x.Sum,
|
||||
Status = x.Status.ToString()
|
||||
Id = x.Id,
|
||||
DateCreate = x.DateCreate,
|
||||
RepairName = x.RepairName,
|
||||
Sum = x.Sum,
|
||||
Status = x.Status.ToString()
|
||||
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public void SaveRepairsToWordFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToWord.CreateDoc(new WordInfo
|
||||
@ -69,7 +65,6 @@ namespace RenovationWorkBusinessLogic.BusinessLogics
|
||||
Repairs = _repairStorage.GetFullList()
|
||||
});
|
||||
}
|
||||
|
||||
public void SaveRepairComponentToExcelFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToExcel.CreateReport(new ExcelInfo
|
||||
@ -79,7 +74,6 @@ namespace RenovationWorkBusinessLogic.BusinessLogics
|
||||
RepairComponents = GetRepairComponent()
|
||||
});
|
||||
}
|
||||
|
||||
public void SaveOrdersToPdfFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToPdf.CreateDoc(new PdfInfo
|
||||
|
@ -5,8 +5,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using RenovationWorkBusinessLogic.OfficePackage.HelperEnums;
|
||||
using RenovationWorkBusinessLogic.OfficePackage.HelperModels;
|
||||
|
||||
namespace RenovationWorkBusinessLogic.OfficePackage
|
||||
{
|
||||
@ -19,7 +17,6 @@ namespace RenovationWorkBusinessLogic.OfficePackage
|
||||
public void CreateReport(ExcelInfo info)
|
||||
{
|
||||
CreateExcel(info);
|
||||
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
@ -27,13 +24,11 @@ namespace RenovationWorkBusinessLogic.OfficePackage
|
||||
Text = info.Title,
|
||||
StyleInfo = ExcelStyleInfoType.Title
|
||||
});
|
||||
|
||||
MergeCells(new ExcelMergeParameters
|
||||
{
|
||||
CellFromName = "A1",
|
||||
CellToName = "C1"
|
||||
});
|
||||
|
||||
uint rowIndex = 2;
|
||||
foreach (var pc in info.RepairComponents)
|
||||
{
|
||||
@ -45,7 +40,6 @@ namespace RenovationWorkBusinessLogic.OfficePackage
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
rowIndex++;
|
||||
|
||||
foreach (var (Component, Count) in pc.Components)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
@ -55,7 +49,6 @@ namespace RenovationWorkBusinessLogic.OfficePackage
|
||||
Text = Component,
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
@ -64,10 +57,8 @@ namespace RenovationWorkBusinessLogic.OfficePackage
|
||||
StyleInfo =
|
||||
ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
@ -84,7 +75,6 @@ namespace RenovationWorkBusinessLogic.OfficePackage
|
||||
});
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
SaveExcel(info);
|
||||
}
|
||||
protected abstract void CreateExcel(ExcelInfo info);
|
||||
|
@ -1,6 +1,4 @@
|
||||
using RenovationWorkBusinessLogic.OfficePackage.HelperEnums;
|
||||
using RenovationWorkBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -8,8 +6,6 @@ using System.Threading.Tasks;
|
||||
using RenovationWorkBusinessLogic.OfficePackage.HelperEnums;
|
||||
using RenovationWorkBusinessLogic.OfficePackage.HelperModels;
|
||||
|
||||
|
||||
|
||||
namespace RenovationWorkBusinessLogic.OfficePackage
|
||||
{
|
||||
public abstract class AbstractSaveToPdf
|
||||
|
@ -5,10 +5,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using RenovationWorkBusinessLogic.OfficePackage.HelperEnums;
|
||||
using RenovationWorkBusinessLogic.OfficePackage.HelperModels;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
||||
namespace RenovationWorkBusinessLogic.OfficePackage
|
||||
{
|
||||
@ -46,6 +42,5 @@ namespace RenovationWorkBusinessLogic.OfficePackage
|
||||
protected abstract void CreateParagraph(WordParagraph paragraph);
|
||||
protected abstract void SaveWord(WordInfo info);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,4 +13,3 @@ namespace RenovationWorkBusinessLogic.OfficePackage.HelperEnums
|
||||
TextWithBroder
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,4 +13,3 @@ namespace RenovationWorkBusinessLogic.OfficePackage.HelperEnums
|
||||
Rigth
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using RenovationWorkBusinessLogic.OfficePackage.HelperEnums;
|
||||
|
||||
|
||||
namespace RenovationWorkBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class PdfParagraph
|
||||
|
@ -1,5 +1,4 @@
|
||||
using RenovationWorkContracts.ViewModels;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
@ -1,5 +1,4 @@
|
||||
using RenovationWorkBusinessLogic.OfficePackage.HelperEnums;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||
using DocumentFormat.OpenXml.Office2013.Excel;
|
||||
using DocumentFormat.OpenXml.Office2016.Excel;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
@ -24,14 +19,11 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
private SpreadsheetDocument? _spreadsheetDocument;
|
||||
private SharedStringTablePart? _shareStringPart;
|
||||
private Worksheet? _worksheet;
|
||||
|
||||
private static void CreateStyles(WorkbookPart workbookpart)
|
||||
{
|
||||
var sp = workbookpart.AddNewPart<WorkbookStylesPart>();
|
||||
sp.Stylesheet = new Stylesheet();
|
||||
|
||||
var fonts = new Fonts() { Count = 2U, KnownFonts = true };
|
||||
|
||||
var fontUsual = new Font();
|
||||
fontUsual.Append(new FontSize() { Val = 12D });
|
||||
fontUsual.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
||||
@ -39,7 +31,6 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
fontUsual.Append(new FontName() { Val = "Times New Roman" });
|
||||
fontUsual.Append(new FontFamilyNumbering() { Val = 2 });
|
||||
fontUsual.Append(new FontScheme() { Val = FontSchemeValues.Minor });
|
||||
|
||||
var fontTitle = new Font();
|
||||
fontTitle.Append(new Bold());
|
||||
fontTitle.Append(new FontSize() { Val = 14D });
|
||||
@ -48,15 +39,11 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
fontTitle.Append(new FontName() { Val = "Times New Roman" });
|
||||
fontTitle.Append(new FontFamilyNumbering() { Val = 2 });
|
||||
fontTitle.Append(new FontScheme() { Val = FontSchemeValues.Minor });
|
||||
|
||||
fonts.Append(fontUsual);
|
||||
fonts.Append(fontTitle);
|
||||
|
||||
var fills = new Fills() { Count = 2U };
|
||||
|
||||
var fill1 = new Fill();
|
||||
fill1.Append(new PatternFill() { PatternType = PatternValues.None });
|
||||
|
||||
var fill2 = new Fill();
|
||||
fill2.Append(new PatternFill()
|
||||
{
|
||||
@ -64,18 +51,14 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
});
|
||||
fills.Append(fill1);
|
||||
fills.Append(fill2);
|
||||
|
||||
var borders = new Borders() { Count = 2U };
|
||||
|
||||
var borderNoBorder = new Border();
|
||||
borderNoBorder.Append(new LeftBorder());
|
||||
borderNoBorder.Append(new RightBorder());
|
||||
borderNoBorder.Append(new TopBorder());
|
||||
borderNoBorder.Append(new BottomBorder());
|
||||
borderNoBorder.Append(new DiagonalBorder());
|
||||
|
||||
var borderThin = new Border();
|
||||
|
||||
var leftBorder = new LeftBorder() { Style = BorderStyleValues.Thin };
|
||||
leftBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
||||
{ Indexed = 64U });
|
||||
@ -99,10 +82,8 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
borderThin.Append(topBorder);
|
||||
borderThin.Append(bottomBorder);
|
||||
borderThin.Append(new DiagonalBorder());
|
||||
|
||||
borders.Append(borderNoBorder);
|
||||
borders.Append(borderThin);
|
||||
|
||||
var cellStyleFormats = new CellStyleFormats() { Count = 1U };
|
||||
var cellFormatStyle = new CellFormat()
|
||||
{
|
||||
@ -112,7 +93,6 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
BorderId = 0U
|
||||
};
|
||||
cellStyleFormats.Append(cellFormatStyle);
|
||||
|
||||
var cellFormats = new CellFormats() { Count = 3U };
|
||||
var cellFormatFont = new CellFormat()
|
||||
{
|
||||
@ -151,7 +131,6 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
cellFormats.Append(cellFormatFont);
|
||||
cellFormats.Append(cellFormatFontAndBorder);
|
||||
cellFormats.Append(cellFormatTitle);
|
||||
|
||||
var cellStyles = new CellStyles() { Count = 1U };
|
||||
cellStyles.Append(new CellStyle()
|
||||
{
|
||||
@ -190,7 +169,6 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
});
|
||||
stylesheetExtensionList.Append(stylesheetExtension1);
|
||||
stylesheetExtensionList.Append(stylesheetExtension2);
|
||||
|
||||
sp.Stylesheet.Append(fonts);
|
||||
sp.Stylesheet.Append(fills);
|
||||
sp.Stylesheet.Append(borders);
|
||||
@ -201,7 +179,6 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
sp.Stylesheet.Append(tableStyles);
|
||||
sp.Stylesheet.Append(stylesheetExtensionList);
|
||||
}
|
||||
|
||||
private static uint GetStyleValue(ExcelStyleInfoType styleInfo)
|
||||
{
|
||||
return styleInfo switch
|
||||
@ -212,7 +189,6 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
_ => 0U,
|
||||
};
|
||||
}
|
||||
|
||||
protected override void CreateExcel(ExcelInfo info)
|
||||
{
|
||||
_spreadsheetDocument = SpreadsheetDocument.Create(info.FileName,
|
||||
@ -220,9 +196,7 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
// Создаем книгу (в ней хранятся листы)
|
||||
var workbookpart = _spreadsheetDocument.AddWorkbookPart();
|
||||
workbookpart.Workbook = new Workbook();
|
||||
|
||||
CreateStyles(workbookpart);
|
||||
|
||||
// Получаем/создаем хранилище текстов для книги
|
||||
_shareStringPart =
|
||||
_spreadsheetDocument.WorkbookPart!.GetPartsOfType<SharedStringTablePart>().Any()
|
||||
@ -235,11 +209,9 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
_shareStringPart.SharedStringTable = new SharedStringTable();
|
||||
}
|
||||
|
||||
// Создаем лист в книгу
|
||||
var worksheetPart = workbookpart.AddNewPart<WorksheetPart>();
|
||||
worksheetPart.Worksheet = new Worksheet(new SheetData());
|
||||
|
||||
// Добавляем лист в книгу
|
||||
var sheets =
|
||||
_spreadsheetDocument.WorkbookPart.Workbook.AppendChild(new Sheets());
|
||||
@ -251,7 +223,6 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
Name = "Лист"
|
||||
};
|
||||
sheets.Append(sheet);
|
||||
|
||||
_worksheet = worksheetPart.Worksheet;
|
||||
}
|
||||
protected override void InsertCellInWorksheet(ExcelCellParameters
|
||||
@ -266,7 +237,6 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Ищем строку, либо добавляем ее
|
||||
Row row;
|
||||
if (sheetData.Elements<Row>().Where(r => r.RowIndex! ==
|
||||
@ -280,7 +250,6 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
row = new Row() { RowIndex = excelParams.RowIndex };
|
||||
sheetData.Append(row);
|
||||
}
|
||||
|
||||
// Ищем нужную ячейку
|
||||
Cell cell;
|
||||
if (row.Elements<Cell>().Where(c => c.CellReference!.Value ==
|
||||
@ -309,10 +278,8 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
excelParams.CellReference
|
||||
};
|
||||
row.InsertBefore(newCell, refCell);
|
||||
|
||||
cell = newCell;
|
||||
}
|
||||
|
||||
// вставляем новый текст
|
||||
_shareStringPart.SharedStringTable.AppendChild(new
|
||||
SharedStringItem(new Text(excelParams.Text)));
|
||||
@ -323,7 +290,6 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
cell.DataType = new EnumValue<CellValues>(CellValues.SharedString);
|
||||
cell.StyleIndex = GetStyleValue(excelParams.StyleInfo);
|
||||
}
|
||||
|
||||
protected override void MergeCells(ExcelMergeParameters excelParams)
|
||||
{
|
||||
if (_worksheet == null)
|
||||
@ -331,7 +297,6 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
return;
|
||||
}
|
||||
MergeCells mergeCells;
|
||||
|
||||
if (_worksheet.Elements<MergeCells>().Any())
|
||||
{
|
||||
mergeCells = _worksheet.Elements<MergeCells>().First();
|
||||
@ -339,7 +304,6 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
else
|
||||
{
|
||||
mergeCells = new MergeCells();
|
||||
|
||||
if (_worksheet.Elements<CustomSheetView>().Any())
|
||||
{
|
||||
_worksheet.InsertAfter(mergeCells,
|
||||
@ -351,14 +315,12 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
_worksheet.Elements<SheetData>().First());
|
||||
}
|
||||
}
|
||||
|
||||
var mergeCell = new MergeCell()
|
||||
{
|
||||
Reference = new StringValue(excelParams.Merge)
|
||||
};
|
||||
mergeCells.Append(mergeCell);
|
||||
}
|
||||
|
||||
protected override void SaveExcel(ExcelInfo info)
|
||||
{
|
||||
if (_spreadsheetDocument == null)
|
||||
@ -370,5 +332,3 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
using MigraDoc.DocumentObjectModel;
|
||||
using MigraDoc.Rendering;
|
||||
using RenovationWorkBusinessLogic.OfficePackage.HelperEnums;
|
||||
using RenovationWorkBusinessLogic.OfficePackage.HelperEnums;
|
||||
using RenovationWorkBusinessLogic.OfficePackage.HelperModels;
|
||||
using MigraDoc.DocumentObjectModel;
|
||||
using MigraDoc.DocumentObjectModel.Tables;
|
||||
@ -10,8 +8,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MigraDoc.DocumentObjectModel.Tables;
|
||||
|
||||
|
||||
namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
@ -103,4 +99,3 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,11 +8,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using RenovationWorkBusinessLogic.OfficePackage.HelperEnums;
|
||||
using RenovationWorkBusinessLogic.OfficePackage.HelperModels;
|
||||
using DocumentFormat.OpenXml;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
|
||||
namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
@ -33,14 +28,11 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
private static SectionProperties CreateSectionProperties()
|
||||
{
|
||||
var properties = new SectionProperties();
|
||||
|
||||
var pageSize = new PageSize
|
||||
{
|
||||
Orient = PageOrientationValues.Portrait
|
||||
};
|
||||
|
||||
properties.AppendChild(pageSize);
|
||||
|
||||
return properties;
|
||||
}
|
||||
private static ParagraphProperties?
|
||||
@ -50,22 +42,17 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var properties = new ParagraphProperties();
|
||||
|
||||
properties.AppendChild(new Justification()
|
||||
{
|
||||
Val =
|
||||
GetJustificationValues(paragraphProperties.JustificationType)
|
||||
});
|
||||
|
||||
properties.AppendChild(new SpacingBetweenLines
|
||||
{
|
||||
LineRule = LineSpacingRuleValues.Auto
|
||||
});
|
||||
|
||||
properties.AppendChild(new Indentation());
|
||||
|
||||
var paragraphMarkRunProperties = new ParagraphMarkRunProperties();
|
||||
if (!string.IsNullOrEmpty(paragraphProperties.Size))
|
||||
{
|
||||
@ -75,7 +62,6 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
});
|
||||
}
|
||||
properties.AppendChild(paragraphMarkRunProperties);
|
||||
|
||||
return properties;
|
||||
}
|
||||
protected override void CreateWord(WordInfo info)
|
||||
@ -95,11 +81,9 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
var docParagraph = new Paragraph();
|
||||
|
||||
docParagraph.AppendChild(CreateParagraphProperties(paragraph.TextProperties));
|
||||
|
||||
foreach (var run in paragraph.Texts)
|
||||
{
|
||||
var docRun = new Run();
|
||||
|
||||
var properties = new RunProperties();
|
||||
properties.AppendChild(new FontSize { Val = run.Item2.Size });
|
||||
if (run.Item2.Bold)
|
||||
@ -115,7 +99,6 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
});
|
||||
docParagraph.AppendChild(docRun);
|
||||
}
|
||||
|
||||
_docBody.AppendChild(docParagraph);
|
||||
}
|
||||
protected override void SaveWord(WordInfo info)
|
||||
@ -125,7 +108,6 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
|
||||
return;
|
||||
}
|
||||
_docBody.AppendChild(CreateSectionProperties());
|
||||
|
||||
_wordDocument.MainDocumentPart!.Document.Save();
|
||||
_wordDocument.Close();
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
using RenovationWorkContracts.BindingModels;
|
||||
using RenovationWorkContracts.ViewModels;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
Loading…
Reference in New Issue
Block a user