add TODOs, bold font and solid borders
This commit is contained in:
parent
88902c09db
commit
cf54488e71
@ -140,7 +140,17 @@ internal class ExcelBuilder
|
|||||||
Val = new EnumValue<FontSchemeValues>(FontSchemeValues.Minor)
|
Val = new EnumValue<FontSchemeValues>(FontSchemeValues.Minor)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// TODO добавить шрифт с жирным
|
fonts.Append(new DocumentFormat.OpenXml.Spreadsheet.Font
|
||||||
|
{
|
||||||
|
FontSize = new FontSize() { Val = 11 },
|
||||||
|
FontName = new FontName() { Val = "Calibri" },
|
||||||
|
FontFamilyNumbering = new FontFamilyNumbering() { Val = 2 },
|
||||||
|
FontScheme = new FontScheme()
|
||||||
|
{
|
||||||
|
Val = new EnumValue<FontSchemeValues>(FontSchemeValues.Minor)
|
||||||
|
},
|
||||||
|
Bold = new Bold() { Val = true }
|
||||||
|
});
|
||||||
workbookStylesPart.Stylesheet.Append(fonts);
|
workbookStylesPart.Stylesheet.Append(fonts);
|
||||||
|
|
||||||
// Default Fill
|
// Default Fill
|
||||||
@ -164,7 +174,14 @@ internal class ExcelBuilder
|
|||||||
BottomBorder = new BottomBorder(),
|
BottomBorder = new BottomBorder(),
|
||||||
DiagonalBorder = new DiagonalBorder()
|
DiagonalBorder = new DiagonalBorder()
|
||||||
});
|
});
|
||||||
// TODO добавить настройку с границами
|
borders.Append(new Border
|
||||||
|
{
|
||||||
|
LeftBorder = new LeftBorder() { Style = BorderStyleValues.Thin },
|
||||||
|
RightBorder = new RightBorder() { Style = BorderStyleValues.Thin },
|
||||||
|
TopBorder = new TopBorder() { Style = BorderStyleValues.Thin },
|
||||||
|
BottomBorder = new BottomBorder() { Style = BorderStyleValues.Thin },
|
||||||
|
DiagonalBorder = new DiagonalBorder()
|
||||||
|
});
|
||||||
workbookStylesPart.Stylesheet.Append(borders);
|
workbookStylesPart.Stylesheet.Append(borders);
|
||||||
|
|
||||||
// Default cell format and a date cell format
|
// Default cell format and a date cell format
|
||||||
@ -183,6 +200,48 @@ internal class ExcelBuilder
|
|||||||
WrapText = true
|
WrapText = true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
cellFormats.Append(new CellFormat
|
||||||
|
{
|
||||||
|
NumberFormatId = 0,
|
||||||
|
FormatId = 0,
|
||||||
|
FontId = 1,
|
||||||
|
BorderId = 0,
|
||||||
|
FillId = 0,
|
||||||
|
Alignment = new Alignment()
|
||||||
|
{
|
||||||
|
Horizontal = HorizontalAlignmentValues.Left,
|
||||||
|
Vertical = VerticalAlignmentValues.Center,
|
||||||
|
WrapText = true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
cellFormats.Append(new CellFormat
|
||||||
|
{
|
||||||
|
NumberFormatId = 0,
|
||||||
|
FormatId = 0,
|
||||||
|
FontId = 0,
|
||||||
|
BorderId = 1,
|
||||||
|
FillId = 0,
|
||||||
|
Alignment = new Alignment()
|
||||||
|
{
|
||||||
|
Horizontal = HorizontalAlignmentValues.Left,
|
||||||
|
Vertical = VerticalAlignmentValues.Center,
|
||||||
|
WrapText = true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
cellFormats.Append(new CellFormat
|
||||||
|
{
|
||||||
|
NumberFormatId = 0,
|
||||||
|
FormatId = 0,
|
||||||
|
FontId = 1,
|
||||||
|
BorderId = 1,
|
||||||
|
FillId = 0,
|
||||||
|
Alignment = new Alignment()
|
||||||
|
{
|
||||||
|
Horizontal = HorizontalAlignmentValues.Left,
|
||||||
|
Vertical = VerticalAlignmentValues.Center,
|
||||||
|
WrapText = true
|
||||||
|
}
|
||||||
|
});
|
||||||
// TODO дополнить форматы
|
// TODO дополнить форматы
|
||||||
workbookStylesPart.Stylesheet.Append(cellFormats);
|
workbookStylesPart.Stylesheet.Append(cellFormats);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using MigraDoc.DocumentObjectModel;
|
using MigraDoc.DocumentObjectModel;
|
||||||
using MigraDoc.DocumentObjectModel.Shapes.Charts;
|
using MigraDoc.DocumentObjectModel.Shapes.Charts;
|
||||||
using MigraDoc.Rendering;
|
using MigraDoc.Rendering;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace PIbd_23_Gutorov_I.A._IT_Company.Reports;
|
namespace PIbd_23_Gutorov_I.A._IT_Company.Reports;
|
||||||
|
|
||||||
@ -66,6 +67,8 @@ internal class PdfBuilder
|
|||||||
|
|
||||||
public void Build()
|
public void Build()
|
||||||
{
|
{
|
||||||
|
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||||
|
|
||||||
var renderer = new PdfDocumentRenderer(true)
|
var renderer = new PdfDocumentRenderer(true)
|
||||||
{
|
{
|
||||||
Document = _document
|
Document = _document
|
||||||
@ -77,7 +80,8 @@ internal class PdfBuilder
|
|||||||
|
|
||||||
private void DefineStyles()
|
private void DefineStyles()
|
||||||
{
|
{
|
||||||
// TODO задать стиль для заголовка (жирный)
|
var headerStyle = _document.Styles.AddStyle("NormalBold", "Normal");
|
||||||
|
headerStyle.Font.Bold = true;
|
||||||
|
headerStyle.Font.Size = 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,8 @@ internal class WordBuilder
|
|||||||
{
|
{
|
||||||
var paragraph = _body.AppendChild(new Paragraph());
|
var paragraph = _body.AppendChild(new Paragraph());
|
||||||
var run = paragraph.AppendChild(new Run());
|
var run = paragraph.AppendChild(new Run());
|
||||||
// TODO bold text
|
var runProperties = run.AppendChild(new RunProperties());
|
||||||
|
runProperties.AppendChild(new Bold());
|
||||||
run.AppendChild(new Text(header));
|
run.AppendChild(new Text(header));
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user