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