//public CellContentFormat() //{ // Append(CreateFormat("dd/mm/yyyy hh:mm:ss", CellFormats.DateTimeFormat)); // Append(CreateFormat("0.0000", CellFormats.Decimal4Format)); // Append(CreateFormat("0.00", CellFormats.Decimal2Format)); // Append(CreateFormat("@", CellFormats.TextFormat)); // Append(CreateFormat("dd.MM.yyyy", CellFormats.DateFormat)); // Append(CreateFormat("0.0", CellFormats.IntFormat)); // Count = UInt32Value.FromUInt32((uint)base.ChildElements.Count); //} private static NumberingFormat CreateFormat(string format, CellFormats formatIndex) { var numberingFormat = new NumberingFormat(); numberingFormat.NumberFormatId = UInt32Value.FromUInt32((uint) formatIndex); numberingFormat.FormatCode = StringValue.FromString(format); return numberingFormat; }
public CustomStylesheet() { // blank font list var fonts = new Fonts(); fonts.AppendChild(new Font()); fonts.Count = 1; Append(fonts); // create fills var fills = new Fills(); // create a solid blue fill var solidBlue = new PatternFill() { PatternType = PatternValues.Solid }; solidBlue.ForegroundColor = new ForegroundColor { Rgb = HexBinaryValue.FromString("397FDB") }; // blue fill solidBlue.BackgroundColor = new BackgroundColor { Indexed = 64 }; fills.AppendChild(new Fill { PatternFill = new PatternFill { PatternType = PatternValues.None } }); // required, reserved by Excel fills.AppendChild(new Fill { PatternFill = new PatternFill { PatternType = PatternValues.Gray125 } }); // required, reserved by Excel fills.AppendChild(new Fill { PatternFill = solidBlue }); fills.Count = 3; Append(fills); // blank border list var borders = new Borders(); borders.AppendChild(new Border()); borders.AppendChild(new Border() { TopBorder = new TopBorder() { Style = BorderStyleValues.Thin }, RightBorder = new RightBorder() { Style = BorderStyleValues.Thin }, BottomBorder = new BottomBorder() { Style = BorderStyleValues.Thin }, LeftBorder = new LeftBorder() { Style = BorderStyleValues.Thin } }); borders.Count = 2; Append(borders); // blank cell format list var cellStyleFormats = new CellStyleFormats(); cellStyleFormats.AppendChild(new CellFormat()); cellStyleFormats.Count = 1; Append(cellStyleFormats); // cell format list var cellFormats = new CellFormats(); // empty one for index 0, seems to be required cellFormats.AppendChild(new CellFormat()); // cell format default with border cellFormats.AppendChild(new CellFormat() { FormatId = 0, FontId = 0, BorderId = 1, FillId = 0 }).AppendChild(new Alignment() { WrapText = true }); // cell format for header (blue with border) cellFormats.AppendChild(new CellFormat { FormatId = 0, FontId = 0, BorderId = 1, FillId = 2, ApplyFill = true }).AppendChild(new Alignment { Horizontal = HorizontalAlignmentValues.Center }); cellFormats.Count = 2; Append(cellFormats); }
private static CellFormat CreateCellStyle(CellFormats format, bool applyNumberFormat = true , FontStyles fontStyle = FontStyles.StandardCalibri , BorderStyles borderStyle = BorderStyles.NoBorder , FillStyles fillStyle = FillStyles.Empty) { var cellFormat = new CellFormat(); cellFormat.NumberFormatId = (uint)format; cellFormat.FontId = (uint)fontStyle; cellFormat.FillId = (uint)fillStyle; cellFormat.BorderId = (uint)borderStyle; cellFormat.FormatId = 0; cellFormat.ApplyNumberFormat = BooleanValue.FromBoolean(applyNumberFormat); return cellFormat; }
private static void ExtractRowsData(List<Object> data, Worksheet worksheet, SharedStringTable ssTable, CellFormats cellFormats) { var columnHeaders = worksheet.FirstRow().Descendants<Cell>().Select(c => Convert.ToString(ProcessCellValue(c, ssTable, cellFormats))).ToArray(); var columnHeadersCellReference = worksheet.FirstRow().Descendants<Cell>().Select(c => c.CellReference.InnerText.Replace("1", string.Empty)).ToArray(); var spreadsheetData = worksheet.SkipFirstRow(); int dataRowIndex = 2; foreach (var dataRow in spreadsheetData) { dynamic row = new ExpandoObject(); Cell[] rowCells = dataRow.Descendants<Cell>().ToArray(); for (int i = 0; i < columnHeaders.Length; i++) { // Selecciona y agrega la celda correcta al archivo de la fila. Cell cell = dataRow.Descendants<Cell>().Where(c => c.CellReference == columnHeadersCellReference[i] + dataRow.RowIndex).FirstOrDefault(); if (cell != null) ((IDictionary<String, Object>)row).Add(new KeyValuePair<String, Object>(dataRowIndex + "," + i, ProcessCellValue(cell, ssTable, cellFormats))); } data.Add(row); ++dataRowIndex; } }
// Generates content of workbookStylesPart1. private void GenerateWorkbookStylesPart1Content(WorkbookStylesPart workbookStylesPart1) { Stylesheet stylesheet1 = new Stylesheet(); NumberingFormats numberingFormats1 = new NumberingFormats() { Count = (UInt32Value)3U }; NumberingFormat numberingFormat1 = new NumberingFormat() { NumberFormatId = (UInt32Value)164U, FormatCode = "_(\"$\"* #,##0.00_);_(\"$\"* \\(#,##0.00\\);_(\"$\"* \"-\"??_);_(@_)" }; NumberingFormat numberingFormat2 = new NumberingFormat() { NumberFormatId = (UInt32Value)165U, FormatCode = "_(* #,##0.00_);_(* \\(#,##0.00\\);_(* \"-\"??_);_(@_)" }; NumberingFormat numberingFormat3 = new NumberingFormat() { NumberFormatId = (UInt32Value)166U, FormatCode = "_-* #,##0\\ _€_-;\\-* #,##0\\ _€_-;_-* \"-\"??\\ _€_-;_-@_-" }; numberingFormats1.Append(numberingFormat1); numberingFormats1.Append(numberingFormat2); numberingFormats1.Append(numberingFormat3); Fonts fonts1 = new Fonts() { Count = (UInt32Value)21U }; Font font1 = new Font(); FontSize fontSize1 = new FontSize() { Val = 11D }; Color color1 = new Color() { Theme = (UInt32Value)1U }; FontName fontName1 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 }; FontScheme fontScheme1 = new FontScheme() { Val = FontSchemeValues.Minor }; font1.Append(fontSize1); font1.Append(color1); font1.Append(fontName1); font1.Append(fontFamilyNumbering1); font1.Append(fontScheme1); Font font2 = new Font(); FontSize fontSize2 = new FontSize() { Val = 10D }; FontName fontName2 = new FontName() { Val = "Arial" }; font2.Append(fontSize2); font2.Append(fontName2); Font font3 = new Font(); FontSize fontSize3 = new FontSize() { Val = 10D }; FontName fontName3 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering2 = new FontFamilyNumbering() { Val = 2 }; font3.Append(fontSize3); font3.Append(fontName3); font3.Append(fontFamilyNumbering2); Font font4 = new Font(); Bold bold1 = new Bold(); FontSize fontSize4 = new FontSize() { Val = 10D }; FontName fontName4 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering3 = new FontFamilyNumbering() { Val = 2 }; font4.Append(bold1); font4.Append(fontSize4); font4.Append(fontName4); font4.Append(fontFamilyNumbering3); Font font5 = new Font(); Bold bold2 = new Bold(); FontSize fontSize5 = new FontSize() { Val = 10D }; Color color2 = new Color() { Indexed = (UInt32Value)9U }; FontName fontName5 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering4 = new FontFamilyNumbering() { Val = 2 }; font5.Append(bold2); font5.Append(fontSize5); font5.Append(color2); font5.Append(fontName5); font5.Append(fontFamilyNumbering4); Font font6 = new Font(); Underline underline1 = new Underline(); FontSize fontSize6 = new FontSize() { Val = 7.5D }; Color color3 = new Color() { Indexed = (UInt32Value)12U }; FontName fontName6 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering5 = new FontFamilyNumbering() { Val = 2 }; font6.Append(underline1); font6.Append(fontSize6); font6.Append(color3); font6.Append(fontName6); font6.Append(fontFamilyNumbering5); Font font7 = new Font(); Bold bold3 = new Bold(); FontSize fontSize7 = new FontSize() { Val = 12D }; FontName fontName7 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering6 = new FontFamilyNumbering() { Val = 2 }; font7.Append(bold3); font7.Append(fontSize7); font7.Append(fontName7); font7.Append(fontFamilyNumbering6); Font font8 = new Font(); Bold bold4 = new Bold(); FontSize fontSize8 = new FontSize() { Val = 9D }; Color color4 = new Color() { Indexed = (UInt32Value)9U }; FontName fontName8 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering7 = new FontFamilyNumbering() { Val = 2 }; font8.Append(bold4); font8.Append(fontSize8); font8.Append(color4); font8.Append(fontName8); font8.Append(fontFamilyNumbering7); Font font9 = new Font(); FontSize fontSize9 = new FontSize() { Val = 9D }; Color color5 = new Color() { Indexed = (UInt32Value)9U }; FontName fontName9 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering8 = new FontFamilyNumbering() { Val = 2 }; font9.Append(fontSize9); font9.Append(color5); font9.Append(fontName9); font9.Append(fontFamilyNumbering8); Font font10 = new Font(); Bold bold5 = new Bold(); FontSize fontSize10 = new FontSize() { Val = 9D }; FontName fontName10 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering9 = new FontFamilyNumbering() { Val = 2 }; font10.Append(bold5); font10.Append(fontSize10); font10.Append(fontName10); font10.Append(fontFamilyNumbering9); Font font11 = new Font(); FontSize fontSize11 = new FontSize() { Val = 9D }; FontName fontName11 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering10 = new FontFamilyNumbering() { Val = 2 }; font11.Append(fontSize11); font11.Append(fontName11); font11.Append(fontFamilyNumbering10); Font font12 = new Font(); Bold bold6 = new Bold(); FontSize fontSize12 = new FontSize() { Val = 9D }; Color color6 = new Color() { Indexed = (UInt32Value)56U }; FontName fontName12 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering11 = new FontFamilyNumbering() { Val = 2 }; font12.Append(bold6); font12.Append(fontSize12); font12.Append(color6); font12.Append(fontName12); font12.Append(fontFamilyNumbering11); Font font13 = new Font(); Bold bold7 = new Bold(); FontSize fontSize13 = new FontSize() { Val = 8D }; FontName fontName13 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering12 = new FontFamilyNumbering() { Val = 2 }; font13.Append(bold7); font13.Append(fontSize13); font13.Append(fontName13); font13.Append(fontFamilyNumbering12); Font font14 = new Font(); Bold bold8 = new Bold(); FontSize fontSize14 = new FontSize() { Val = 8D }; Color color7 = new Color() { Indexed = (UInt32Value)9U }; FontName fontName14 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering13 = new FontFamilyNumbering() { Val = 2 }; font14.Append(bold8); font14.Append(fontSize14); font14.Append(color7); font14.Append(fontName14); font14.Append(fontFamilyNumbering13); Font font15 = new Font(); Bold bold9 = new Bold(); FontSize fontSize15 = new FontSize() { Val = 10D }; Color color8 = new Color() { Indexed = (UInt32Value)10U }; FontName fontName15 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering14 = new FontFamilyNumbering() { Val = 2 }; font15.Append(bold9); font15.Append(fontSize15); font15.Append(color8); font15.Append(fontName15); font15.Append(fontFamilyNumbering14); Font font16 = new Font(); FontSize fontSize16 = new FontSize() { Val = 8D }; FontName fontName16 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering15 = new FontFamilyNumbering() { Val = 2 }; font16.Append(fontSize16); font16.Append(fontName16); font16.Append(fontFamilyNumbering15); Font font17 = new Font(); Bold bold10 = new Bold(); FontSize fontSize17 = new FontSize() { Val = 15D }; FontName fontName17 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering16 = new FontFamilyNumbering() { Val = 2 }; font17.Append(bold10); font17.Append(fontSize17); font17.Append(fontName17); font17.Append(fontFamilyNumbering16); Font font18 = new Font(); Bold bold11 = new Bold(); FontSize fontSize18 = new FontSize() { Val = 9D }; Color color9 = new Color() { Indexed = (UInt32Value)12U }; FontName fontName18 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering17 = new FontFamilyNumbering() { Val = 2 }; font18.Append(bold11); font18.Append(fontSize18); font18.Append(color9); font18.Append(fontName18); font18.Append(fontFamilyNumbering17); Font font19 = new Font(); Underline underline2 = new Underline(); FontSize fontSize19 = new FontSize() { Val = 12D }; Color color10 = new Color() { Indexed = (UInt32Value)12U }; FontName fontName19 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering18 = new FontFamilyNumbering() { Val = 2 }; font19.Append(underline2); font19.Append(fontSize19); font19.Append(color10); font19.Append(fontName19); font19.Append(fontFamilyNumbering18); Font font20 = new Font(); Bold bold12 = new Bold(); FontSize fontSize20 = new FontSize() { Val = 11D }; FontName fontName20 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering19 = new FontFamilyNumbering() { Val = 2 }; font20.Append(bold12); font20.Append(fontSize20); font20.Append(fontName20); font20.Append(fontFamilyNumbering19); Font font21 = new Font(); FontSize fontSize21 = new FontSize() { Val = 12D }; FontName fontName21 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering20 = new FontFamilyNumbering() { Val = 2 }; font21.Append(fontSize21); font21.Append(fontName21); font21.Append(fontFamilyNumbering20); fonts1.Append(font1); fonts1.Append(font2); fonts1.Append(font3); fonts1.Append(font4); fonts1.Append(font5); fonts1.Append(font6); fonts1.Append(font7); fonts1.Append(font8); fonts1.Append(font9); fonts1.Append(font10); fonts1.Append(font11); fonts1.Append(font12); fonts1.Append(font13); fonts1.Append(font14); fonts1.Append(font15); fonts1.Append(font16); fonts1.Append(font17); fonts1.Append(font18); fonts1.Append(font19); fonts1.Append(font20); fonts1.Append(font21); Fills fills1 = new Fills() { Count = (UInt32Value)14U }; Fill fill1 = new Fill(); PatternFill patternFill1 = new PatternFill() { PatternType = PatternValues.None }; fill1.Append(patternFill1); Fill fill2 = new Fill(); PatternFill patternFill2 = new PatternFill() { PatternType = PatternValues.Gray125 }; fill2.Append(patternFill2); Fill fill3 = new Fill(); PatternFill patternFill3 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor1 = new ForegroundColor() { Indexed = (UInt32Value)9U }; BackgroundColor backgroundColor1 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill3.Append(foregroundColor1); patternFill3.Append(backgroundColor1); fill3.Append(patternFill3); Fill fill4 = new Fill(); PatternFill patternFill4 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor2 = new ForegroundColor() { Indexed = (UInt32Value)10U }; BackgroundColor backgroundColor2 = new BackgroundColor() { Indexed = (UInt32Value)26U }; patternFill4.Append(foregroundColor2); patternFill4.Append(backgroundColor2); fill4.Append(patternFill4); Fill fill5 = new Fill(); PatternFill patternFill5 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor3 = new ForegroundColor() { Indexed = (UInt32Value)10U }; BackgroundColor backgroundColor3 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill5.Append(foregroundColor3); patternFill5.Append(backgroundColor3); fill5.Append(patternFill5); Fill fill6 = new Fill(); PatternFill patternFill6 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor4 = new ForegroundColor() { Indexed = (UInt32Value)9U }; BackgroundColor backgroundColor4 = new BackgroundColor() { Indexed = (UInt32Value)26U }; patternFill6.Append(foregroundColor4); patternFill6.Append(backgroundColor4); fill6.Append(patternFill6); Fill fill7 = new Fill(); PatternFill patternFill7 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor5 = new ForegroundColor() { Indexed = (UInt32Value)63U }; BackgroundColor backgroundColor5 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill7.Append(foregroundColor5); patternFill7.Append(backgroundColor5); fill7.Append(patternFill7); Fill fill8 = new Fill(); PatternFill patternFill8 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor6 = new ForegroundColor() { Indexed = (UInt32Value)55U }; BackgroundColor backgroundColor6 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill8.Append(foregroundColor6); patternFill8.Append(backgroundColor6); fill8.Append(patternFill8); Fill fill9 = new Fill(); PatternFill patternFill9 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor7 = new ForegroundColor() { Indexed = (UInt32Value)43U }; BackgroundColor backgroundColor7 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill9.Append(foregroundColor7); patternFill9.Append(backgroundColor7); fill9.Append(patternFill9); Fill fill10 = new Fill(); PatternFill patternFill10 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor8 = new ForegroundColor() { Indexed = (UInt32Value)45U }; BackgroundColor backgroundColor8 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill10.Append(foregroundColor8); patternFill10.Append(backgroundColor8); fill10.Append(patternFill10); Fill fill11 = new Fill(); PatternFill patternFill11 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor9 = new ForegroundColor() { Indexed = (UInt32Value)42U }; BackgroundColor backgroundColor9 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill11.Append(foregroundColor9); patternFill11.Append(backgroundColor9); fill11.Append(patternFill11); Fill fill12 = new Fill(); PatternFill patternFill12 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor10 = new ForegroundColor() { Indexed = (UInt32Value)47U }; BackgroundColor backgroundColor10 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill12.Append(foregroundColor10); patternFill12.Append(backgroundColor10); fill12.Append(patternFill12); Fill fill13 = new Fill(); PatternFill patternFill13 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor11 = new ForegroundColor() { Indexed = (UInt32Value)22U }; BackgroundColor backgroundColor11 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill13.Append(foregroundColor11); patternFill13.Append(backgroundColor11); fill13.Append(patternFill13); Fill fill14 = new Fill(); PatternFill patternFill14 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor12 = new ForegroundColor() { Indexed = (UInt32Value)23U }; BackgroundColor backgroundColor12 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill14.Append(foregroundColor12); patternFill14.Append(backgroundColor12); fill14.Append(patternFill14); fills1.Append(fill1); fills1.Append(fill2); fills1.Append(fill3); fills1.Append(fill4); fills1.Append(fill5); fills1.Append(fill6); fills1.Append(fill7); fills1.Append(fill8); fills1.Append(fill9); fills1.Append(fill10); fills1.Append(fill11); fills1.Append(fill12); fills1.Append(fill13); fills1.Append(fill14); Borders borders1 = new Borders() { Count = (UInt32Value)9U }; Border border1 = new Border(); LeftBorder leftBorder1 = new LeftBorder(); RightBorder rightBorder1 = new RightBorder(); TopBorder topBorder1 = new TopBorder(); BottomBorder bottomBorder1 = new BottomBorder(); DiagonalBorder diagonalBorder1 = new DiagonalBorder(); border1.Append(leftBorder1); border1.Append(rightBorder1); border1.Append(topBorder1); border1.Append(bottomBorder1); border1.Append(diagonalBorder1); Border border2 = new Border(); LeftBorder leftBorder2 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color11 = new Color() { Indexed = (UInt32Value)64U }; leftBorder2.Append(color11); RightBorder rightBorder2 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color12 = new Color() { Indexed = (UInt32Value)64U }; rightBorder2.Append(color12); TopBorder topBorder2 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color13 = new Color() { Indexed = (UInt32Value)64U }; topBorder2.Append(color13); BottomBorder bottomBorder2 = new BottomBorder(); DiagonalBorder diagonalBorder2 = new DiagonalBorder(); border2.Append(leftBorder2); border2.Append(rightBorder2); border2.Append(topBorder2); border2.Append(bottomBorder2); border2.Append(diagonalBorder2); Border border3 = new Border(); LeftBorder leftBorder3 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color14 = new Color() { Indexed = (UInt32Value)64U }; leftBorder3.Append(color14); RightBorder rightBorder3 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color15 = new Color() { Indexed = (UInt32Value)64U }; rightBorder3.Append(color15); TopBorder topBorder3 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color16 = new Color() { Indexed = (UInt32Value)64U }; topBorder3.Append(color16); BottomBorder bottomBorder3 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color17 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder3.Append(color17); DiagonalBorder diagonalBorder3 = new DiagonalBorder(); border3.Append(leftBorder3); border3.Append(rightBorder3); border3.Append(topBorder3); border3.Append(bottomBorder3); border3.Append(diagonalBorder3); Border border4 = new Border(); LeftBorder leftBorder4 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color18 = new Color() { Indexed = (UInt32Value)64U }; leftBorder4.Append(color18); RightBorder rightBorder4 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color19 = new Color() { Indexed = (UInt32Value)64U }; rightBorder4.Append(color19); TopBorder topBorder4 = new TopBorder(); BottomBorder bottomBorder4 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color20 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder4.Append(color20); DiagonalBorder diagonalBorder4 = new DiagonalBorder(); border4.Append(leftBorder4); border4.Append(rightBorder4); border4.Append(topBorder4); border4.Append(bottomBorder4); border4.Append(diagonalBorder4); Border border5 = new Border(); LeftBorder leftBorder5 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color21 = new Color() { Indexed = (UInt32Value)64U }; leftBorder5.Append(color21); RightBorder rightBorder5 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color22 = new Color() { Indexed = (UInt32Value)64U }; rightBorder5.Append(color22); TopBorder topBorder5 = new TopBorder(); BottomBorder bottomBorder5 = new BottomBorder(); DiagonalBorder diagonalBorder5 = new DiagonalBorder(); border5.Append(leftBorder5); border5.Append(rightBorder5); border5.Append(topBorder5); border5.Append(bottomBorder5); border5.Append(diagonalBorder5); Border border6 = new Border(); LeftBorder leftBorder6 = new LeftBorder(); RightBorder rightBorder6 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color23 = new Color() { Indexed = (UInt32Value)64U }; rightBorder6.Append(color23); TopBorder topBorder6 = new TopBorder(); BottomBorder bottomBorder6 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color24 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder6.Append(color24); DiagonalBorder diagonalBorder6 = new DiagonalBorder(); border6.Append(leftBorder6); border6.Append(rightBorder6); border6.Append(topBorder6); border6.Append(bottomBorder6); border6.Append(diagonalBorder6); Border border7 = new Border(); LeftBorder leftBorder7 = new LeftBorder() { Style = BorderStyleValues.Medium }; Color color25 = new Color() { Indexed = (UInt32Value)64U }; leftBorder7.Append(color25); RightBorder rightBorder7 = new RightBorder(); TopBorder topBorder7 = new TopBorder() { Style = BorderStyleValues.Medium }; Color color26 = new Color() { Indexed = (UInt32Value)64U }; topBorder7.Append(color26); BottomBorder bottomBorder7 = new BottomBorder() { Style = BorderStyleValues.Medium }; Color color27 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder7.Append(color27); DiagonalBorder diagonalBorder7 = new DiagonalBorder(); border7.Append(leftBorder7); border7.Append(rightBorder7); border7.Append(topBorder7); border7.Append(bottomBorder7); border7.Append(diagonalBorder7); Border border8 = new Border(); LeftBorder leftBorder8 = new LeftBorder(); RightBorder rightBorder8 = new RightBorder(); TopBorder topBorder8 = new TopBorder() { Style = BorderStyleValues.Medium }; Color color28 = new Color() { Indexed = (UInt32Value)64U }; topBorder8.Append(color28); BottomBorder bottomBorder8 = new BottomBorder() { Style = BorderStyleValues.Medium }; Color color29 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder8.Append(color29); DiagonalBorder diagonalBorder8 = new DiagonalBorder(); border8.Append(leftBorder8); border8.Append(rightBorder8); border8.Append(topBorder8); border8.Append(bottomBorder8); border8.Append(diagonalBorder8); Border border9 = new Border(); LeftBorder leftBorder9 = new LeftBorder(); RightBorder rightBorder9 = new RightBorder() { Style = BorderStyleValues.Medium }; Color color30 = new Color() { Indexed = (UInt32Value)64U }; rightBorder9.Append(color30); TopBorder topBorder9 = new TopBorder() { Style = BorderStyleValues.Medium }; Color color31 = new Color() { Indexed = (UInt32Value)64U }; topBorder9.Append(color31); BottomBorder bottomBorder9 = new BottomBorder() { Style = BorderStyleValues.Medium }; Color color32 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder9.Append(color32); DiagonalBorder diagonalBorder9 = new DiagonalBorder(); border9.Append(leftBorder9); border9.Append(rightBorder9); border9.Append(topBorder9); border9.Append(bottomBorder9); border9.Append(diagonalBorder9); borders1.Append(border1); borders1.Append(border2); borders1.Append(border3); borders1.Append(border4); borders1.Append(border5); borders1.Append(border6); borders1.Append(border7); borders1.Append(border8); borders1.Append(border9); CellStyleFormats cellStyleFormats1 = new CellStyleFormats() { Count = (UInt32Value)5U }; CellFormat cellFormat1 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U }; CellFormat cellFormat2 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U }; CellFormat cellFormat3 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)5U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, ApplyNumberFormat = false, ApplyFill = false, ApplyBorder = false, ApplyAlignment = false, ApplyProtection = false }; Alignment alignment1 = new Alignment() { Vertical = VerticalAlignmentValues.Top }; Protection protection1 = new Protection() { Locked = false }; cellFormat3.Append(alignment1); cellFormat3.Append(protection1); CellFormat cellFormat4 = new CellFormat() { NumberFormatId = (UInt32Value)165U, FontId = (UInt32Value)2U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, ApplyFont = false, ApplyFill = false, ApplyBorder = false, ApplyAlignment = false, ApplyProtection = false }; CellFormat cellFormat5 = new CellFormat() { NumberFormatId = (UInt32Value)164U, FontId = (UInt32Value)2U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, ApplyFont = false, ApplyFill = false, ApplyBorder = false, ApplyAlignment = false, ApplyProtection = false }; cellStyleFormats1.Append(cellFormat1); cellStyleFormats1.Append(cellFormat2); cellStyleFormats1.Append(cellFormat3); cellStyleFormats1.Append(cellFormat4); cellStyleFormats1.Append(cellFormat5); CellFormats cellFormats1 = new CellFormats() { Count = (UInt32Value)71U }; CellFormat cellFormat6 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; CellFormat cellFormat7 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment2 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat7.Append(alignment2); CellFormat cellFormat8 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true }; CellFormat cellFormat9 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment3 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat9.Append(alignment3); CellFormat cellFormat10 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment4 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat10.Append(alignment4); CellFormat cellFormat11 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment5 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; cellFormat11.Append(alignment5); CellFormat cellFormat12 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)7U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment6 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat12.Append(alignment6); CellFormat cellFormat13 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)7U, FillId = (UInt32Value)4U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment7 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat13.Append(alignment7); CellFormat cellFormat14 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)8U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true }; CellFormat cellFormat15 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)9U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)3U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat16 = new CellFormat() { NumberFormatId = (UInt32Value)20U, FontId = (UInt32Value)9U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment8 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center }; cellFormat16.Append(alignment8); CellFormat cellFormat17 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)7U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat18 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)7U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment9 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat18.Append(alignment9); CellFormat cellFormat19 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)9U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment10 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat19.Append(alignment10); CellFormat cellFormat20 = new CellFormat() { NumberFormatId = (UInt32Value)17U, FontId = (UInt32Value)11U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment11 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; cellFormat20.Append(alignment11); CellFormat cellFormat21 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)10U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true }; CellFormat cellFormat22 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)10U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment12 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat22.Append(alignment12); CellFormat cellFormat23 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)8U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true }; CellFormat cellFormat24 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)8U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat25 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)10U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true }; CellFormat cellFormat26 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)10U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyAlignment = true }; Alignment alignment13 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat26.Append(alignment13); CellFormat cellFormat27 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)7U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)4U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment14 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat27.Append(alignment14); CellFormat cellFormat28 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)10U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true }; CellFormat cellFormat29 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)12U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment15 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat29.Append(alignment15); CellFormat cellFormat30 = new CellFormat() { NumberFormatId = (UInt32Value)166U, FontId = (UInt32Value)3U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)3U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment16 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat30.Append(alignment16); CellFormat cellFormat31 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)12U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment17 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat31.Append(alignment17); CellFormat cellFormat32 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)13U, FillId = (UInt32Value)7U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment18 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat32.Append(alignment18); CellFormat cellFormat33 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)14U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment19 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat33.Append(alignment19); CellFormat cellFormat34 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)10U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat35 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)12U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat36 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)12U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true }; CellFormat cellFormat37 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)13U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat38 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment20 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; cellFormat38.Append(alignment20); CellFormat cellFormat39 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment21 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; cellFormat39.Append(alignment21); CellFormat cellFormat40 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat41 = new CellFormat() { NumberFormatId = (UInt32Value)20U, FontId = (UInt32Value)10U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment22 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat41.Append(alignment22); CellFormat cellFormat42 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)15U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)6U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat43 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)15U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)7U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat44 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)16U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)7U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment23 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat44.Append(alignment23); CellFormat cellFormat45 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)15U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)8U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat46 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)15U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat47 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)16U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment24 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat47.Append(alignment24); CellFormat cellFormat48 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)9U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true }; CellFormat cellFormat49 = new CellFormat() { NumberFormatId = (UInt32Value)17U, FontId = (UInt32Value)17U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment25 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; cellFormat49.Append(alignment25); CellFormat cellFormat50 = new CellFormat() { NumberFormatId = (UInt32Value)17U, FontId = (UInt32Value)9U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment26 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; cellFormat50.Append(alignment26); CellFormat cellFormat51 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)18U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)2U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true, ApplyProtection = true }; CellFormat cellFormat52 = new CellFormat() { NumberFormatId = (UInt32Value)49U, FontId = (UInt32Value)10U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; CellFormat cellFormat53 = new CellFormat() { NumberFormatId = (UInt32Value)1U, FontId = (UInt32Value)6U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true }; CellFormat cellFormat54 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)10U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment27 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat54.Append(alignment27); CellFormat cellFormat55 = new CellFormat() { NumberFormatId = (UInt32Value)1U, FontId = (UInt32Value)9U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true }; CellFormat cellFormat56 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)19U, FillId = (UInt32Value)8U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment28 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat56.Append(alignment28); CellFormat cellFormat57 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)9U, FillId = (UInt32Value)7U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat58 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)9U, FillId = (UInt32Value)7U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment29 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat58.Append(alignment29); CellFormat cellFormat59 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)6U, FillId = (UInt32Value)8U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment30 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat59.Append(alignment30); CellFormat cellFormat60 = new CellFormat() { NumberFormatId = (UInt32Value)49U, FontId = (UInt32Value)6U, FillId = (UInt32Value)8U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment31 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat60.Append(alignment31); CellFormat cellFormat61 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)6U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment32 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat61.Append(alignment32); CellFormat cellFormat62 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)20U, FillId = (UInt32Value)10U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment33 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat62.Append(alignment33); CellFormat cellFormat63 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)20U, FillId = (UInt32Value)11U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment34 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat63.Append(alignment34); CellFormat cellFormat64 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)20U, FillId = (UInt32Value)9U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment35 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat64.Append(alignment35); CellFormat cellFormat65 = new CellFormat() { NumberFormatId = (UInt32Value)16U, FontId = (UInt32Value)9U, FillId = (UInt32Value)12U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment36 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center }; cellFormat65.Append(alignment36); CellFormat cellFormat66 = new CellFormat() { NumberFormatId = (UInt32Value)17U, FontId = (UInt32Value)3U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true }; CellFormat cellFormat67 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)10U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment37 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center }; cellFormat67.Append(alignment37); CellFormat cellFormat68 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)10U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment38 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right, Vertical = VerticalAlignmentValues.Center }; cellFormat68.Append(alignment38); CellFormat cellFormat69 = new CellFormat() { NumberFormatId = (UInt32Value)16U, FontId = (UInt32Value)10U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment39 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center }; cellFormat69.Append(alignment39); CellFormat cellFormat70 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)19U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment40 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat70.Append(alignment40); CellFormat cellFormat71 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)10U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment41 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat71.Append(alignment41); CellFormat cellFormat72 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)10U, FillId = (UInt32Value)13U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment42 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat72.Append(alignment42); CellFormat cellFormat73 = new CellFormat() { NumberFormatId = (UInt32Value)2U, FontId = (UInt32Value)3U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)4U, FormatId = (UInt32Value)4U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment43 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat73.Append(alignment43); CellFormat cellFormat74 = new CellFormat() { NumberFormatId = (UInt32Value)2U, FontId = (UInt32Value)3U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)4U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment44 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat74.Append(alignment44); CellFormat cellFormat75 = new CellFormat() { NumberFormatId = (UInt32Value)2U, FontId = (UInt32Value)3U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)3U, FormatId = (UInt32Value)4U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment45 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat75.Append(alignment45); CellFormat cellFormat76 = new CellFormat() { NumberFormatId = (UInt32Value)2U, FontId = (UInt32Value)4U, FillId = (UInt32Value)7U, BorderId = (UInt32Value)5U, FormatId = (UInt32Value)4U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment46 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat76.Append(alignment46); cellFormats1.Append(cellFormat6); cellFormats1.Append(cellFormat7); cellFormats1.Append(cellFormat8); cellFormats1.Append(cellFormat9); cellFormats1.Append(cellFormat10); cellFormats1.Append(cellFormat11); cellFormats1.Append(cellFormat12); cellFormats1.Append(cellFormat13); cellFormats1.Append(cellFormat14); cellFormats1.Append(cellFormat15); cellFormats1.Append(cellFormat16); cellFormats1.Append(cellFormat17); cellFormats1.Append(cellFormat18); cellFormats1.Append(cellFormat19); cellFormats1.Append(cellFormat20); cellFormats1.Append(cellFormat21); cellFormats1.Append(cellFormat22); cellFormats1.Append(cellFormat23); cellFormats1.Append(cellFormat24); cellFormats1.Append(cellFormat25); cellFormats1.Append(cellFormat26); cellFormats1.Append(cellFormat27); cellFormats1.Append(cellFormat28); cellFormats1.Append(cellFormat29); cellFormats1.Append(cellFormat30); cellFormats1.Append(cellFormat31); cellFormats1.Append(cellFormat32); cellFormats1.Append(cellFormat33); cellFormats1.Append(cellFormat34); cellFormats1.Append(cellFormat35); cellFormats1.Append(cellFormat36); cellFormats1.Append(cellFormat37); cellFormats1.Append(cellFormat38); cellFormats1.Append(cellFormat39); cellFormats1.Append(cellFormat40); cellFormats1.Append(cellFormat41); cellFormats1.Append(cellFormat42); cellFormats1.Append(cellFormat43); cellFormats1.Append(cellFormat44); cellFormats1.Append(cellFormat45); cellFormats1.Append(cellFormat46); cellFormats1.Append(cellFormat47); cellFormats1.Append(cellFormat48); cellFormats1.Append(cellFormat49); cellFormats1.Append(cellFormat50); cellFormats1.Append(cellFormat51); cellFormats1.Append(cellFormat52); cellFormats1.Append(cellFormat53); cellFormats1.Append(cellFormat54); cellFormats1.Append(cellFormat55); cellFormats1.Append(cellFormat56); cellFormats1.Append(cellFormat57); cellFormats1.Append(cellFormat58); cellFormats1.Append(cellFormat59); cellFormats1.Append(cellFormat60); cellFormats1.Append(cellFormat61); cellFormats1.Append(cellFormat62); cellFormats1.Append(cellFormat63); cellFormats1.Append(cellFormat64); cellFormats1.Append(cellFormat65); cellFormats1.Append(cellFormat66); cellFormats1.Append(cellFormat67); cellFormats1.Append(cellFormat68); cellFormats1.Append(cellFormat69); cellFormats1.Append(cellFormat70); cellFormats1.Append(cellFormat71); cellFormats1.Append(cellFormat72); cellFormats1.Append(cellFormat73); cellFormats1.Append(cellFormat74); cellFormats1.Append(cellFormat75); cellFormats1.Append(cellFormat76); CellStyles cellStyles1 = new CellStyles() { Count = (UInt32Value)5U }; CellStyle cellStyle1 = new CellStyle() { Name = "Hipervínculo", FormatId = (UInt32Value)2U, BuiltinId = (UInt32Value)8U }; CellStyle cellStyle2 = new CellStyle() { Name = "Millares 2", FormatId = (UInt32Value)3U }; CellStyle cellStyle3 = new CellStyle() { Name = "Moneda 2", FormatId = (UInt32Value)4U }; CellStyle cellStyle4 = new CellStyle() { Name = "Normal", FormatId = (UInt32Value)0U, BuiltinId = (UInt32Value)0U }; CellStyle cellStyle5 = new CellStyle() { Name = "Normal 2", FormatId = (UInt32Value)1U }; cellStyles1.Append(cellStyle1); cellStyles1.Append(cellStyle2); cellStyles1.Append(cellStyle3); cellStyles1.Append(cellStyle4); cellStyles1.Append(cellStyle5); DifferentialFormats differentialFormats1 = new DifferentialFormats() { Count = (UInt32Value)0U }; TableStyles tableStyles1 = new TableStyles() { Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium9", DefaultPivotStyle = "PivotStyleLight16" }; stylesheet1.Append(numberingFormats1); stylesheet1.Append(fonts1); stylesheet1.Append(fills1); stylesheet1.Append(borders1); stylesheet1.Append(cellStyleFormats1); stylesheet1.Append(cellFormats1); stylesheet1.Append(cellStyles1); stylesheet1.Append(differentialFormats1); stylesheet1.Append(tableStyles1); workbookStylesPart1.Stylesheet = stylesheet1; }
/// <summary> /// Creates a default stylesheet for a spreadsheet /// </summary> /// <returns>New stylesheet with following parameters: /// 1. Fonts: /// 1) Font size: 12, Font name: Times New Roman /// 2) Font size: 12, Font name: Times New Roman, Font color: White, Font weight: Bold /// 2. Fills: /// 1) No fill /// 2) #7D7D7D /// 3) #666666 /// 3. Borders: /// 1) No borders /// 2) Thin black borders /// 4. Cell formats: /// 1) Default /// 2) Font: 1, Fill: 1, Borders: 2, Alignment: <see cref="HorizontalAlignmentValues.Left"/>-<see cref="VerticalAlignmentValues.Center"/> /// 3) Font: 2, Fill: 3, Borders: 2, Alignment: <see cref="HorizontalAlignmentValues.Left"/>-<see cref="VerticalAlignmentValues.Center"/> /// 4) Font: 1, Fill: 1, Borders: 1, Alignment: <see cref="HorizontalAlignmentValues.Center"/>-<see cref="VerticalAlignmentValues.Center"/> /// 5) Font: 1, Fill: 1, Borders: 2, Alignment: <see cref="HorizontalAlignmentValues.Center"/>-<see cref="VerticalAlignmentValues.Center"/> /// 6) Font: 1, Fill: 1, Borders: 2, Alignment: <see cref="HorizontalAlignmentValues.Left"/>-<see cref="VerticalAlignmentValues.Center"/> /// </returns> public static Stylesheet GenerateStylesheet() { var fonts = new Fonts( new Font( new FontSize { Val = 12 }, new FontName { Val = "Times New Roman" } ), new Font( new FontSize { Val = 12 }, new Bold(), new Color { Rgb = "FFFFFF" }, new FontName { Val = "Times New Roman" } )); var fills = new Fills( new Fill(new PatternFill { PatternType = PatternValues.None }), new Fill(new PatternFill { PatternType = PatternValues.Gray125 }), new Fill(new PatternFill(new ForegroundColor { Rgb = new HexBinaryValue { Value = "66666666" } }) { PatternType = PatternValues.Solid }) ); var borders = new Borders( new Border(), new Border( new LeftBorder(new Color { Auto = true }) { Style = BorderStyleValues.Thin }, new RightBorder(new Color { Auto = true }) { Style = BorderStyleValues.Thin }, new TopBorder(new Color { Auto = true }) { Style = BorderStyleValues.Thin }, new BottomBorder(new Color { Auto = true }) { Style = BorderStyleValues.Thin }, new DiagonalBorder()) ); var cellFormats = new CellFormats( new CellFormat(), new CellFormat { FontId = 0, FillId = 0, BorderId = 1, Alignment = new Alignment { Horizontal = HorizontalAlignmentValues.Left, Vertical = VerticalAlignmentValues.Center, Indent = 1 }, ApplyAlignment = true, ApplyFill = true, ApplyBorder = true, ApplyFont = true }, new CellFormat { FontId = 1, FillId = 2, BorderId = 1, Alignment = new Alignment { Horizontal = HorizontalAlignmentValues.Left, Vertical = VerticalAlignmentValues.Center, Indent = 1 }, ApplyAlignment = true, ApplyFill = true, ApplyBorder = true, ApplyFont = true }, new CellFormat { FontId = 0, FillId = 0, BorderId = 0, Alignment = new Alignment { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center }, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyFont = true }, new CellFormat { FontId = 0, FillId = 0, BorderId = 1, Alignment = new Alignment { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center }, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyFont = true }, new CellFormat { FontId = 0, FillId = 0, BorderId = 1, Alignment = new Alignment { Horizontal = HorizontalAlignmentValues.Left, Vertical = VerticalAlignmentValues.Center, Indent = 1 }, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyFont = true } ); var styleSheet = new Stylesheet(fonts, fills, borders, cellFormats); return(styleSheet); }
// Generates content of workbookStylesPart1. private void GenerateWorkbookStylesPart1Content(WorkbookStylesPart workbookStylesPart1) { Stylesheet stylesheet1 = new Stylesheet() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "x14ac" } }; stylesheet1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); stylesheet1.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"); Fonts fonts1 = new Fonts() { Count = (UInt32Value)1U, KnownFonts = true }; Font font1 = new Font(); FontSize fontSize1 = new FontSize() { Val = 11D }; Color color1 = new Color() { Theme = (UInt32Value)1U }; FontName fontName1 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 }; FontScheme fontScheme1 = new FontScheme() { Val = FontSchemeValues.Minor }; font1.Append(fontSize1); font1.Append(color1); font1.Append(fontName1); font1.Append(fontFamilyNumbering1); font1.Append(fontScheme1); fonts1.Append(font1); Fills fills1 = new Fills() { Count = (UInt32Value)2U }; Fill fill1 = new Fill(); PatternFill patternFill1 = new PatternFill() { PatternType = PatternValues.None }; fill1.Append(patternFill1); Fill fill2 = new Fill(); PatternFill patternFill2 = new PatternFill() { PatternType = PatternValues.Gray125 }; fill2.Append(patternFill2); fills1.Append(fill1); fills1.Append(fill2); Borders borders1 = new Borders() { Count = (UInt32Value)1U }; Border border1 = new Border(); LeftBorder leftBorder1 = new LeftBorder(); RightBorder rightBorder1 = new RightBorder(); TopBorder topBorder1 = new TopBorder(); BottomBorder bottomBorder1 = new BottomBorder(); DiagonalBorder diagonalBorder1 = new DiagonalBorder(); border1.Append(leftBorder1); border1.Append(rightBorder1); border1.Append(topBorder1); border1.Append(bottomBorder1); border1.Append(diagonalBorder1); borders1.Append(border1); CellStyleFormats cellStyleFormats1 = new CellStyleFormats() { Count = (UInt32Value)1U }; CellFormat cellFormat1 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U }; cellStyleFormats1.Append(cellFormat1); CellFormats cellFormats1 = new CellFormats() { Count = (UInt32Value)1U }; CellFormat cellFormat2 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; cellFormats1.Append(cellFormat2); CellStyles cellStyles1 = new CellStyles() { Count = (UInt32Value)1U }; CellStyle cellStyle1 = new CellStyle() { Name = "Normal", FormatId = (UInt32Value)0U, BuiltinId = (UInt32Value)0U }; cellStyles1.Append(cellStyle1); DifferentialFormats differentialFormats1 = new DifferentialFormats() { Count = (UInt32Value)0U }; TableStyles tableStyles1 = new TableStyles() { Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleLight16" }; stylesheet1.Append(fonts1); stylesheet1.Append(fills1); stylesheet1.Append(borders1); stylesheet1.Append(cellStyleFormats1); stylesheet1.Append(cellFormats1); stylesheet1.Append(cellStyles1); stylesheet1.Append(differentialFormats1); stylesheet1.Append(tableStyles1); workbookStylesPart1.Stylesheet = stylesheet1; }
public static Stylesheet CreateStylesheet() { var ss = new Stylesheet(); var fts = new Fonts(); var ftn = new FontName { Val = "Arial" }; var ftsz = new FontSize { Val = 11 }; var ft = new DocumentFormat.OpenXml.Spreadsheet.Font { FontName = ftn, FontSize = ftsz }; fts.Append(ft); fts.Count = (uint)fts.ChildElements.Count; var fills = new Fills(); var fill = new Fill(); var patternFill = new PatternFill { PatternType = PatternValues.None }; fill.PatternFill = patternFill; fills.Append(fill); fill = new Fill(); patternFill = new PatternFill { PatternType = PatternValues.Gray125 }; fill.PatternFill = patternFill; fills.Append(fill); fills.Count = (uint)fills.ChildElements.Count; var borders = new Borders(); var border = new Border { LeftBorder = new LeftBorder(), RightBorder = new RightBorder(), TopBorder = new TopBorder(), BottomBorder = new BottomBorder(), DiagonalBorder = new DiagonalBorder() }; borders.Append(border); borders.Count = (uint)borders.ChildElements.Count; var csfs = new CellStyleFormats(); var cf = new CellFormat { NumberFormatId = 0, FontId = 0, FillId = 0, BorderId = 0 }; csfs.Append(cf); csfs.Count = (uint)csfs.ChildElements.Count; // dd/mm/yyyy is also Excel style index 14 uint iExcelIndex = 164; var nfs = new NumberingFormats(); var cfs = new CellFormats(); cf = new CellFormat { NumberFormatId = 0, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0 }; cfs.Append(cf); var nf = new NumberingFormat { NumberFormatId = iExcelIndex, FormatCode = "dd/mm/yyyy hh:mm:ss" }; nfs.Append(nf); cf = new CellFormat { NumberFormatId = nf.NumberFormatId, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = true }; cfs.Append(cf); iExcelIndex = 165; nfs = new NumberingFormats(); cfs = new CellFormats(); cf = new CellFormat { NumberFormatId = 0, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0 }; cfs.Append(cf); nf = new NumberingFormat { NumberFormatId = iExcelIndex, FormatCode = "MMM yyyy" }; nfs.Append(nf); cf = new CellFormat { NumberFormatId = nf.NumberFormatId, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = true }; cfs.Append(cf); iExcelIndex = 170; nf = new NumberingFormat { NumberFormatId = iExcelIndex, FormatCode = "#,##0.0000" }; nfs.Append(nf); cf = new CellFormat { NumberFormatId = nf.NumberFormatId, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = true }; cfs.Append(cf); // #,##0.00 is also Excel style index 4 iExcelIndex = 171; nf = new NumberingFormat { NumberFormatId = iExcelIndex, FormatCode = "#,##0.00" }; nfs.Append(nf); cf = new CellFormat { NumberFormatId = nf.NumberFormatId, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = true }; cfs.Append(cf); // @ is also Excel style index 49 iExcelIndex = 172; nf = new NumberingFormat { NumberFormatId = iExcelIndex, FormatCode = "@" }; nfs.Append(nf); cf = new CellFormat { NumberFormatId = nf.NumberFormatId, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = true }; cfs.Append(cf); nfs.Count = (uint)nfs.ChildElements.Count; cfs.Count = (uint)cfs.ChildElements.Count; ss.Append(nfs); ss.Append(fts); ss.Append(fills); ss.Append(borders); ss.Append(csfs); ss.Append(cfs); var css = new CellStyles(); var cs = new CellStyle { Name = "Normal", FormatId = 0, BuiltinId = 0 }; css.Append(cs); css.Count = (uint)css.ChildElements.Count; ss.Append(css); var dfs = new DifferentialFormats { Count = 0 }; ss.Append(dfs); var tss = new TableStyles { Count = 0, DefaultTableStyle = "TableStyleMedium9", DefaultPivotStyle = "PivotStyleLight16" }; ss.Append(tss); return ss; }
public MatchData MatchCellLayouts(MatchData md, IEnumerable<Cell> tcs, SheetLayout sheetLayout, SharedStringTablePart stringTable, CellFormats formats, FileInfo file) { // Obtain titles for all field cell layouts md.fldCellVersMaps = new List<FieldCellVersionMap>(); foreach (var fldLayout in sheetLayout.wsLayout.cellLayouts) { var fldLayoutVals = new List<FieldCellMap>(); foreach (var cellLoc in fldLayout.cellLocations) { try { var cl = tcs.FirstOrDefault(cll => cll.CellReference.InnerText == cellLoc.TitleRef); var clVal = tcs.FirstOrDefault(clv => clv.CellReference.InnerText == cellLoc.ValueRef); var title = Spreadsheet.GetCellValue(cl, stringTable.SharedStringTable, formats, null); if (title != null) title = System.Text.RegularExpressions.Regex.Replace(title, @"\s+", " ").Trim().ToLower(); var val = Spreadsheet.GetCellValue(clVal, stringTable.SharedStringTable, formats, null); fldLayoutVals.Add(new FieldCellMap { cellLoc = cellLoc, Title = string.IsNullOrWhiteSpace(title) ? null : title.Trim().ToLower(), Value = string.IsNullOrWhiteSpace(val) ? null : val.Trim() }); } catch (Exception ex) { Log.New.Msg(ex); } } md.fldCellVersMaps.Add(new FieldCellVersionMap { fldmaps = fldLayoutVals, fldLayout = fldLayout }); } md.fldCellVersMaps.ForEach(vm => vm.fldmaps.ForEach(vfm => vfm.versMap = vm)); var reqFlds = sheetLayout.wsLayout.fields.Where(sf => sf.fldType == FieldType.cell && sf.isRequired); // Match Titles to layout fields foreach (var flvv in md.fldCellVersMaps) { var agMaps = new List<FieldCellMap>(); foreach (var fm in flvv.fldmaps.Where(m => m.Title != null)) { MatchField(tcs, fm, sheetLayout, stringTable, formats, agMaps); } flvv.fldmaps.AddRange(agMaps); // Only keep data containing CellDataLayouts var fmts = new List<CellDataLayout> { CellDataLayout.combined, CellDataLayout.separate }; flvv.fldmaps = flvv.fldmaps.Where(fm => fm.cellLoc != null && fmts.Contains(fm.cellLoc.dataLayout)).ToList(); // Add a filename layout if the field exists. var fileName = sheetLayout.wsLayout.fields.FirstOrDefault(fld => fld.fldType == FieldType.fileName); if (fileName != null) { flvv.fldmaps.Add(new FieldCellMap { Title = FieldType.fileName.ToString(), field = fileName, Value = file.Name }); } // Add a filePath layout if the field exists. var filePath = sheetLayout.wsLayout.fields.FirstOrDefault(fld => fld.fldType == FieldType.filePath); if (filePath != null) { flvv.fldmaps.Add(new FieldCellMap { Title = FieldType.filePath.ToString(), field = filePath, Value = file.FullName }); } // Compute how well the matching went. flvv.noneNullTitleCnt = flvv.fldmaps.Where(fm => !string.IsNullOrWhiteSpace(fm.Title)).Count(); flvv.noMatchCnt = flvv.fldmaps.Where(fm => fm.field == null).Count(); flvv.missingReqFldCnt = reqFlds.Where(rf => !flvv.fldmaps.Select(fm => fm.field).Contains(rf)).Count(); flvv.noReqValCnt = flvv.fldmaps.Where(fm => fm.field != null && fm.field.isRequired && string.IsNullOrWhiteSpace(fm.Value)).Count(); flvv.noValCnt = flvv.fldmaps.Where(fm => fm.field != null && string.IsNullOrWhiteSpace(fm.Value)).Count(); } // Find the best acceptable layout match. var fldLayout_v = md.fldCellVersMaps .Where(fl => fl.noMatchCnt == 0 && fl.noReqValCnt == 0 && fl.missingReqFldCnt == 0) .OrderByDescending(fl => fl.fldmaps.Count()) .OrderBy(fl => fl.noValCnt) .FirstOrDefault(); md.fldCellMap = fldLayout_v; md.matchCnt += md.fldCellMap != null ? 1 : 0; return md; }
private static void GenerateWorkbookStylesPartContent(WorkbookStylesPart workbookStylesPart1) { Stylesheet stylesheet1 = new Stylesheet() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "x14ac x16r2 xr" } }; stylesheet1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); stylesheet1.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"); stylesheet1.AddNamespaceDeclaration("x16r2", "http://schemas.microsoft.com/office/spreadsheetml/2015/02/main"); stylesheet1.AddNamespaceDeclaration("xr", "http://schemas.microsoft.com/office/spreadsheetml/2014/revision"); Fonts fonts1 = new Fonts() { Count = (UInt32Value)1U, KnownFonts = true }; Font font1 = new Font(); FontSize fontSize1 = new FontSize() { Val = 11D }; Color color1 = new Color() { Theme = (UInt32Value)1U }; FontName fontName1 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 }; FontScheme fontScheme1 = new FontScheme() { Val = FontSchemeValues.Minor }; font1.Append(fontSize1); font1.Append(color1); font1.Append(fontName1); font1.Append(fontFamilyNumbering1); font1.Append(fontScheme1); fonts1.Append(font1); Fills fills1 = new Fills() { Count = (UInt32Value)2U }; Fill fill1 = new Fill(); PatternFill patternFill1 = new PatternFill() { PatternType = PatternValues.None }; fill1.Append(patternFill1); Fill fill2 = new Fill(); PatternFill patternFill2 = new PatternFill() { PatternType = PatternValues.Gray125 }; fill2.Append(patternFill2); fills1.Append(fill1); fills1.Append(fill2); Borders borders1 = new Borders() { Count = (UInt32Value)1U }; Border border1 = new Border(); LeftBorder leftBorder1 = new LeftBorder(); RightBorder rightBorder1 = new RightBorder(); TopBorder topBorder1 = new TopBorder(); BottomBorder bottomBorder1 = new BottomBorder(); DiagonalBorder diagonalBorder1 = new DiagonalBorder(); border1.Append(leftBorder1); border1.Append(rightBorder1); border1.Append(topBorder1); border1.Append(bottomBorder1); border1.Append(diagonalBorder1); borders1.Append(border1); CellStyleFormats cellStyleFormats1 = new CellStyleFormats() { Count = (UInt32Value)1U }; CellFormat cellFormat1 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U }; cellStyleFormats1.Append(cellFormat1); CellFormats cellFormats1 = new CellFormats() { Count = (UInt32Value)2U }; CellFormat cellFormat2 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; CellFormat cellFormat3 = new CellFormat() { NumberFormatId = (UInt32Value)14U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true }; cellFormats1.Append(cellFormat2); cellFormats1.Append(cellFormat3); CellStyles cellStyles1 = new CellStyles() { Count = (UInt32Value)1U }; CellStyle cellStyle1 = new CellStyle() { Name = "Normal", FormatId = (UInt32Value)0U, BuiltinId = (UInt32Value)0U }; cellStyles1.Append(cellStyle1); DifferentialFormats differentialFormats1 = new DifferentialFormats() { Count = (UInt32Value)0U }; TableStyles tableStyles1 = new TableStyles() { Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleLight16" }; StylesheetExtensionList stylesheetExtensionList1 = new StylesheetExtensionList(); StylesheetExtension stylesheetExtension1 = new StylesheetExtension() { Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}" }; stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"); StylesheetExtension stylesheetExtension2 = new StylesheetExtension() { Uri = "{9260A510-F301-46a8-8635-F512D64BE5F5}" }; stylesheetExtension2.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"); OpenXmlUnknownElement openXmlUnknownElement4 = OpenXmlUnknownElement.CreateOpenXmlUnknownElement("<x15:timelineStyles defaultTimelineStyle=\"TimeSlicerStyleLight1\" xmlns:x15=\"http://schemas.microsoft.com/office/spreadsheetml/2010/11/main\" />"); stylesheetExtension2.Append(openXmlUnknownElement4); stylesheetExtensionList1.Append(stylesheetExtension1); stylesheetExtensionList1.Append(stylesheetExtension2); stylesheet1.Append(fonts1); stylesheet1.Append(fills1); stylesheet1.Append(borders1); stylesheet1.Append(cellStyleFormats1); stylesheet1.Append(cellFormats1); stylesheet1.Append(cellStyles1); stylesheet1.Append(differentialFormats1); stylesheet1.Append(tableStyles1); stylesheet1.Append(stylesheetExtensionList1); workbookStylesPart1.Stylesheet = stylesheet1; }
private Stylesheet createStyleSheet() { Stylesheet stylesheet = new Stylesheet(); Fonts fts = new Fonts(); DocumentFormat.OpenXml.Spreadsheet.Font ft = new DocumentFormat.OpenXml.Spreadsheet.Font(); FontName ftn = new FontName(); ftn.Val = StringValue.FromString("Calibri"); FontSize ftsz = new FontSize(); ftsz.Val = DoubleValue.FromDouble(11); ft.FontName = ftn; ft.FontSize = ftsz; fts.Append(ft); ft = new DocumentFormat.OpenXml.Spreadsheet.Font(); ftn = new FontName(); ftn.Val = StringValue.FromString("Palatino Linotype"); ftsz = new FontSize(); ftsz.Val = DoubleValue.FromDouble(18); ft.FontName = ftn; ft.FontSize = ftsz; fts.Append(ft); fts.Count = UInt32Value.FromUInt32((uint)fts.ChildElements.Count); Fills fills = new Fills(); Fill fill; PatternFill patternFill; fill = new Fill(); patternFill = new PatternFill(); patternFill.PatternType = PatternValues.None; fill.PatternFill = patternFill; fills.Append(fill); fill = new Fill(); patternFill = new PatternFill(); patternFill.PatternType = PatternValues.Gray125; fill.PatternFill = patternFill; fills.Append(fill); fill = new Fill(); patternFill = new PatternFill(); patternFill.PatternType = PatternValues.Solid; patternFill.ForegroundColor = new ForegroundColor(); patternFill.ForegroundColor.Rgb = HexBinaryValue.FromString("00ff9728"); patternFill.BackgroundColor = new BackgroundColor(); patternFill.BackgroundColor.Rgb = patternFill.ForegroundColor.Rgb; fill.PatternFill = patternFill; fills.Append(fill); fills.Count = UInt32Value.FromUInt32((uint)fills.ChildElements.Count); Borders borders = new Borders(); Border border = new Border(); border.LeftBorder = new LeftBorder(); border.RightBorder = new RightBorder(); border.TopBorder = new TopBorder(); border.BottomBorder = new BottomBorder(); border.DiagonalBorder = new DiagonalBorder(); borders.Append(border); border = new Border(); border.LeftBorder = new LeftBorder(); border.LeftBorder.Style = BorderStyleValues.Thin; CellStyleFormats cellStyleFormats = new CellStyleFormats(); CellFormat cellFormat = new CellFormat(); cellFormat.NumberFormatId = 0; cellFormat.FontId = 0; cellFormat.FillId = 0; cellFormat.BorderId = 0; cellStyleFormats.Append(cellFormat); cellStyleFormats.Count = UInt32Value.FromUInt32((uint)cellStyleFormats.ChildElements.Count); uint iExcelIndex = 164; NumberingFormats numberFormats = new NumberingFormats(); CellFormats cellFormats = new CellFormats(); cellFormat = new CellFormat(); cellFormat.NumberFormatId = 0; cellFormat.FontId = 0; cellFormat.FillId = 0; cellFormat.BorderId = 0; cellFormat.FormatId = 0; cellFormats.Append(cellFormat); NumberingFormat nfDateTime = new NumberingFormat(); nfDateTime.NumberFormatId = UInt32Value.FromUInt32(iExcelIndex++); nfDateTime.FormatCode = StringValue.FromString(this.DateTimeFormat); numberFormats.Append(nfDateTime); NumberingFormat nfDate = new NumberingFormat(); nfDate.NumberFormatId = UInt32Value.FromUInt32(iExcelIndex++); nfDate.FormatCode = StringValue.FromString(this.DateFormat); numberFormats.Append(nfDate); // index 1 cellFormat = new CellFormat(); cellFormat.NumberFormatId = nfDateTime.NumberFormatId; cellFormat.FontId = 0; cellFormat.FillId = 0; cellFormat.BorderId = 0; cellFormat.FormatId = 0; cellFormat.ApplyNumberFormat = BooleanValue.FromBoolean(true); cellFormats.Append(cellFormat); cellFormat = new CellFormat(); cellFormat.NumberFormatId = nfDate.NumberFormatId; cellFormat.FontId = 0; cellFormat.FillId = 0; cellFormat.BorderId = 0; cellFormat.FormatId = 0; cellFormat.ApplyNumberFormat = BooleanValue.FromBoolean(true); cellFormats.Append(cellFormat); numberFormats.Count = UInt32Value.FromUInt32((uint)numberFormats.ChildElements.Count); cellFormats.Count = UInt32Value.FromUInt32((uint)cellFormats.ChildElements.Count); stylesheet.Append(numberFormats); stylesheet.Append(fts); stylesheet.Append(fills); stylesheet.Append(borders); stylesheet.Append(cellStyleFormats); stylesheet.Append(cellFormats); CellStyles css = new CellStyles(); CellStyle cs = new CellStyle(); cs.Name = StringValue.FromString("Normal"); cs.FormatId = 0; cs.BuiltinId = 0; css.Append(cs); css.Count = UInt32Value.FromUInt32((uint)css.ChildElements.Count); stylesheet.Append(css); DifferentialFormats dfs = new DifferentialFormats(); dfs.Count = 0; stylesheet.Append(dfs); TableStyles tss = new TableStyles(); tss.Count = 0; tss.DefaultTableStyle = StringValue.FromString("TableStyleMedium9"); tss.DefaultPivotStyle = StringValue.FromString("PivotStyleLight16"); stylesheet.Append(tss); return(stylesheet); }
private void CreateWorkBookStylesPart(WorkbookStylesPart workbookStylesPart) { Stylesheet styleSheet = new Stylesheet(); Fonts fonts = new Fonts(); fonts.Append(new DocumentFormat.OpenXml.Spreadsheet.Font() { FontName = new FontName() { Val = "Calibri" }, FontSize = new FontSize() { Val = 11 }, FontFamilyNumbering = new FontFamilyNumbering() { Val = 2 }, }); fonts.Count = (uint)fonts.ChildElements.Count; Fills fills = new Fills(); fills.Append(new Fill() { PatternFill = new PatternFill() { PatternType = PatternValues.None } }); fills.Count = (uint)fills.ChildElements.Count; // Create "borders" node. Borders borders = new Borders(); borders.Append(new Border() { LeftBorder = new LeftBorder(), RightBorder = new RightBorder(), TopBorder = new TopBorder(), BottomBorder = new BottomBorder(), DiagonalBorder = new DiagonalBorder() }); borders.Count = (uint)borders.ChildElements.Count; // Create "cellStyleXfs" node. var CellStyleFormats = new CellStyleFormats(); CellStyleFormats.Append(new CellFormat() { NumberFormatId = 0, FontId = 0, FillId = 0, BorderId = 0 }); CellStyleFormats.Count = (uint)CellStyleFormats.ChildElements.Count; // Create "cellXfs" node. var CellFormats = new CellFormats(); CellFormats.Append(new CellFormat() { BorderId = 0, FillId = 0, FontId = 0, FormatId = 0, NumberFormatId = 0, //ApplyNumberFormat = true }); CellFormats.Count = (uint)CellFormats.ChildElements.Count; // Create "cellStyles" node. var CellStyles = new CellStyles(); CellStyles.Append(new CellStyle() { Name = "Normal", FormatId = 0, BuiltinId = 0 }); CellStyles.Count = (uint)CellStyles.ChildElements.Count; //// Append all nodes in order. styleSheet.Append(fonts); styleSheet.Append(fills); styleSheet.Append(borders); styleSheet.Append(CellStyleFormats); styleSheet.Append(CellFormats); styleSheet.Append(CellStyles); _dateStyleId = CreateCellFormat(styleSheet, null, null, UInt32Value.FromUInt32(22)); // Set the style of workbook workbookStylesPart.Stylesheet = styleSheet; }
Stylesheet AddStyles(StylesDictionary styles) { Color autoColor() { return(new Color() { Auto = true }); } Fonts fonts = new Fonts( new Font( // Index 0 - default new FontSize() { Val = 11 } ), new Font( // Index 1 - bold new FontSize() { Val = 11 }, new Bold() ), new Font( // Index 2 - title new FontSize() { Val = 14 }, new Bold() )); Borders borders = new Borders( new Border(), // index 0 default new Border( // index 1 black border new LeftBorder(autoColor()) { Style = BorderStyleValues.Thin }, new RightBorder(autoColor()) { Style = BorderStyleValues.Thin }, new TopBorder(autoColor()) { Style = BorderStyleValues.Thin }, new BottomBorder(autoColor()) { Style = BorderStyleValues.Thin }, new DiagonalBorder()), new Border( // index 2 bottom border new LeftBorder(), new RightBorder(), new TopBorder(), new BottomBorder(autoColor()) { Style = BorderStyleValues.Thin }, new DiagonalBorder()) ); Fills fills = new Fills( new Fill(new PatternFill() { PatternType = PatternValues.None })); NumberingFormats numFormats = new NumberingFormats( /*date*/ new NumberingFormat() { FormatCode = "dd\\.mm\\.yyyy;@", NumberFormatId = 166 }, /*datetime*/ new NumberingFormat() { FormatCode = "dd\\.mm\\.yyyy hh:mm;@", NumberFormatId = 167 }, /*currency*/ new NumberingFormat() { FormatCode = "#,##0.00####;[Red]\\-#,##0.00####", NumberFormatId = 169 }, /*number*/ new NumberingFormat() { FormatCode = "#,##0.######;[Red]-#,##0.######", NumberFormatId = 170 }, /*time*/ new NumberingFormat() { FormatCode = "hh:mm;@", NumberFormatId = 165 } ); CellFormats cellFormats = new CellFormats(new CellFormat()); for (var i = 1 /*1-based!*/; i < styles.List.Count; i++) { Style st = styles.List[i]; cellFormats.Append(CreateCellFormat(st)); } return(new Stylesheet(numFormats, fonts, fills, borders, cellFormats)); }
// Generates content of workbookStylesPart1. private void GenerateWorkbookStylesPart1Content(WorkbookStylesPart workbookStylesPart1) { Stylesheet stylesheet1 = new Stylesheet(){ MCAttributes = new MarkupCompatibilityAttributes(){ Ignorable = "x14ac" } }; stylesheet1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); stylesheet1.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"); Fonts fonts1 = new Fonts(){ Count = (UInt32Value)2U }; Font font1 = new Font(); FontSize fontSize1 = new FontSize(){ Val = 11D }; Color color1 = new Color(){ Theme = (UInt32Value)1U }; FontName fontName1 = new FontName(){ Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering(){ Val = 2 }; FontCharSet fontCharSet1 = new FontCharSet(){ Val = 128 }; FontScheme fontScheme1 = new FontScheme(){ Val = FontSchemeValues.Minor }; font1.Append(fontSize1); font1.Append(color1); font1.Append(fontName1); font1.Append(fontFamilyNumbering1); font1.Append(fontCharSet1); font1.Append(fontScheme1); Font font2 = new Font(); FontSize fontSize2 = new FontSize(){ Val = 6D }; FontName fontName2 = new FontName(){ Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering2 = new FontFamilyNumbering(){ Val = 2 }; FontCharSet fontCharSet2 = new FontCharSet(){ Val = 128 }; FontScheme fontScheme2 = new FontScheme(){ Val = FontSchemeValues.Minor }; font2.Append(fontSize2); font2.Append(fontName2); font2.Append(fontFamilyNumbering2); font2.Append(fontCharSet2); font2.Append(fontScheme2); fonts1.Append(font1); fonts1.Append(font2); Fills fills1 = new Fills(){ Count = (UInt32Value)2U }; Fill fill1 = new Fill(); PatternFill patternFill1 = new PatternFill(){ PatternType = PatternValues.None }; fill1.Append(patternFill1); Fill fill2 = new Fill(); PatternFill patternFill2 = new PatternFill(){ PatternType = PatternValues.Gray125 }; fill2.Append(patternFill2); fills1.Append(fill1); fills1.Append(fill2); Borders borders1 = new Borders(){ Count = (UInt32Value)1U }; Border border1 = new Border(); LeftBorder leftBorder1 = new LeftBorder(); RightBorder rightBorder1 = new RightBorder(); TopBorder topBorder1 = new TopBorder(); BottomBorder bottomBorder1 = new BottomBorder(); DiagonalBorder diagonalBorder1 = new DiagonalBorder(); border1.Append(leftBorder1); border1.Append(rightBorder1); border1.Append(topBorder1); border1.Append(bottomBorder1); border1.Append(diagonalBorder1); borders1.Append(border1); CellStyleFormats cellStyleFormats1 = new CellStyleFormats(){ Count = (UInt32Value)1U }; CellFormat cellFormat1 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U }; Alignment alignment1 = new Alignment(){ Vertical = VerticalAlignmentValues.Center }; cellFormat1.Append(alignment1); cellStyleFormats1.Append(cellFormat1); CellFormats cellFormats1 = new CellFormats(){ Count = (UInt32Value)1U }; CellFormat cellFormat2 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; Alignment alignment2 = new Alignment(){ Vertical = VerticalAlignmentValues.Center }; cellFormat2.Append(alignment2); cellFormats1.Append(cellFormat2); CellStyles cellStyles1 = new CellStyles(){ Count = (UInt32Value)1U }; CellStyle cellStyle1 = new CellStyle(){ Name = "Normal", FormatId = (UInt32Value)0U, BuiltinId = (UInt32Value)0U }; cellStyles1.Append(cellStyle1); DifferentialFormats differentialFormats1 = new DifferentialFormats(){ Count = (UInt32Value)0U }; TableStyles tableStyles1 = new TableStyles(){ Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleLight16" }; StylesheetExtensionList stylesheetExtensionList1 = new StylesheetExtensionList(); StylesheetExtension stylesheetExtension1 = new StylesheetExtension(){ Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}" }; stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"); X14.SlicerStyles slicerStyles1 = new X14.SlicerStyles(){ DefaultSlicerStyle = "SlicerStyleLight1" }; stylesheetExtension1.Append(slicerStyles1); StylesheetExtension stylesheetExtension2 = new StylesheetExtension(){ Uri = "{9260A510-F301-46a8-8635-F512D64BE5F5}" }; stylesheetExtension2.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"); X15.TimelineStyles timelineStyles1 = new X15.TimelineStyles(){ DefaultTimelineStyle = "TimeSlicerStyleLight1" }; stylesheetExtension2.Append(timelineStyles1); stylesheetExtensionList1.Append(stylesheetExtension1); stylesheetExtensionList1.Append(stylesheetExtension2); stylesheet1.Append(fonts1); stylesheet1.Append(fills1); stylesheet1.Append(borders1); stylesheet1.Append(cellStyleFormats1); stylesheet1.Append(cellFormats1); stylesheet1.Append(cellStyles1); stylesheet1.Append(differentialFormats1); stylesheet1.Append(tableStyles1); stylesheet1.Append(stylesheetExtensionList1); workbookStylesPart1.Stylesheet = stylesheet1; }
private static Stylesheet OpenXML_CreateStylesheet() { // 08/25/2012 The file will be corrupt unless fonts, fills and borders are also provided. var stylesheet = new Stylesheet(); var fonts = new Fonts (new[] { new Font () }) { Count = 1 }; var fills = new Fills (new[] { new Fill () }) { Count = 1 }; var borders = new Borders (new[] { new Border () }) { Count = 1 }; var cellFormats = new CellFormats(new[] { new CellFormat() }) { Count = 1 }; stylesheet.Append(fonts ); stylesheet.Append(fills ); stylesheet.Append(borders ); stylesheet.Append(cellFormats); return stylesheet; }
// Creates an Stylesheet instance and adds its children. public Stylesheet GenerateStylesheet() { Stylesheet stylesheet1 = new Stylesheet() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "x14ac" } }; stylesheet1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); stylesheet1.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"); Fonts fonts1 = new Fonts() { Count = (UInt32Value)1U }; Font font1 = new Font(); FontSize fontSize1 = new FontSize() { Val = 11D }; FontName fontName1 = new FontName() { Val = "Calibri" }; font1.Append(fontSize1); font1.Append(fontName1); fonts1.Append(font1); Fills fills1 = new Fills() { Count = (UInt32Value)2U }; Fill fill1 = new Fill(); PatternFill patternFill1 = new PatternFill() { PatternType = PatternValues.None }; fill1.Append(patternFill1); Fill fill2 = new Fill(); PatternFill patternFill2 = new PatternFill() { PatternType = PatternValues.Gray125 }; fill2.Append(patternFill2); fills1.Append(fill1); fills1.Append(fill2); Borders borders1 = new Borders() { Count = (UInt32Value)1U }; Border border1 = new Border(); LeftBorder leftBorder1 = new LeftBorder(); RightBorder rightBorder1 = new RightBorder(); TopBorder topBorder1 = new TopBorder(); BottomBorder bottomBorder1 = new BottomBorder(); DiagonalBorder diagonalBorder1 = new DiagonalBorder(); border1.Append(leftBorder1); border1.Append(rightBorder1); border1.Append(topBorder1); border1.Append(bottomBorder1); border1.Append(diagonalBorder1); Border border2 = new Border(); LeftBorder leftBorder2 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color1 = new Color() { Indexed = (UInt32Value)64U }; leftBorder2.Append(color1); RightBorder rightBorder2 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color2 = new Color() { Indexed = (UInt32Value)64U }; rightBorder2.Append(color2); TopBorder topBorder2 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color3 = new Color() { Indexed = (UInt32Value)64U }; topBorder2.Append(color3); BottomBorder bottomBorder2 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color4 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder2.Append(color4); DiagonalBorder diagonalBorder2 = new DiagonalBorder() { Style = BorderStyleValues.Thin }; Color color5 = new Color() { Indexed = (UInt32Value)64U }; diagonalBorder2.Append(color5); border2.Append(leftBorder2); border2.Append(rightBorder2); border2.Append(topBorder2); border2.Append(bottomBorder2); border2.Append(diagonalBorder2); borders1.Append(border1); borders1.Append(border2); CellStyleFormats cellStyleFormats1 = new CellStyleFormats() { Count = (UInt32Value)1U }; CellFormat cellFormat1 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U }; cellStyleFormats1.Append(cellFormat1); CellFormats cellFormats1 = new CellFormats() { Count = (UInt32Value)1U }; CellFormat cellFormat2 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; cellFormats1.Append(cellFormat2); CellStyles cellStyles1 = new CellStyles() { Count = (UInt32Value)1U }; CellStyle cellStyle1 = new CellStyle() { Name = "Normal", FormatId = (UInt32Value)0U, BuiltinId = (UInt32Value)0U }; cellStyles1.Append(cellStyle1); DifferentialFormats differentialFormats1 = new DifferentialFormats() { Count = (UInt32Value)0U }; TableStyles tableStyles1 = new TableStyles() { Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleLight16" }; StylesheetExtensionList stylesheetExtensionList1 = new StylesheetExtensionList(); StylesheetExtension stylesheetExtension1 = new StylesheetExtension() { Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}" }; stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"); DocumentFormat.OpenXml.Office2010.Excel.SlicerStyles slicerStyles1 = new DocumentFormat.OpenXml.Office2010.Excel.SlicerStyles() { DefaultSlicerStyle = "SlicerStyleLight1" }; stylesheetExtension1.Append(slicerStyles1); stylesheetExtensionList1.Append(stylesheetExtension1); stylesheet1.Append(fonts1); stylesheet1.Append(fills1); stylesheet1.Append(borders1); stylesheet1.Append(cellStyleFormats1); stylesheet1.Append(cellFormats1); stylesheet1.Append(cellStyles1); stylesheet1.Append(differentialFormats1); stylesheet1.Append(tableStyles1); stylesheet1.Append(stylesheetExtensionList1); return stylesheet1; }
// Generates content of workbookStylesPart1. private void GenerateWorkbookStylesPart1Content(WorkbookStylesPart workbookStylesPart1) { Stylesheet stylesheet1 = new Stylesheet(); NumberingFormats numberingFormats1 = new NumberingFormats() { Count = (UInt32Value)3U }; NumberingFormat numberingFormat1 = new NumberingFormat() { NumberFormatId = (UInt32Value)186U, FormatCode = "_-* #,##0.00\\ \"pta\"_-;\\-* #,##0.00\\ \"pta\"_-;_-* \"-\"??\\ \"pta\"_-;_-@_-" }; NumberingFormat numberingFormat2 = new NumberingFormat() { NumberFormatId = (UInt32Value)194U, FormatCode = "[$$-2C0A]\\ #,##0.00" }; NumberingFormat numberingFormat3 = new NumberingFormat() { NumberFormatId = (UInt32Value)195U, FormatCode = "\"$\"\\ #,##0.00" }; numberingFormats1.Append(numberingFormat1); numberingFormats1.Append(numberingFormat2); numberingFormats1.Append(numberingFormat3); Fonts fonts1 = new Fonts() { Count = (UInt32Value)17U }; Font font1 = new Font(); FontSize fontSize1 = new FontSize() { Val = 10D }; FontName fontName1 = new FontName() { Val = "Arial" }; font1.Append(fontSize1); font1.Append(fontName1); Font font2 = new Font(); FontSize fontSize2 = new FontSize() { Val = 10D }; FontName fontName2 = new FontName() { Val = "Arial" }; font2.Append(fontSize2); font2.Append(fontName2); Font font3 = new Font(); FontSize fontSize3 = new FontSize() { Val = 8D }; FontName fontName3 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 }; font3.Append(fontSize3); font3.Append(fontName3); font3.Append(fontFamilyNumbering1); Font font4 = new Font(); FontSize fontSize4 = new FontSize() { Val = 8D }; FontName fontName4 = new FontName() { Val = "Times New Roman" }; FontFamilyNumbering fontFamilyNumbering2 = new FontFamilyNumbering() { Val = 1 }; font4.Append(fontSize4); font4.Append(fontName4); font4.Append(fontFamilyNumbering2); Font font5 = new Font(); Bold bold1 = new Bold(); FontSize fontSize5 = new FontSize() { Val = 8D }; FontName fontName5 = new FontName() { Val = "Times New Roman" }; FontFamilyNumbering fontFamilyNumbering3 = new FontFamilyNumbering() { Val = 1 }; font5.Append(bold1); font5.Append(fontSize5); font5.Append(fontName5); font5.Append(fontFamilyNumbering3); Font font6 = new Font(); Bold bold2 = new Bold(); FontSize fontSize6 = new FontSize() { Val = 8D }; FontName fontName6 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering4 = new FontFamilyNumbering() { Val = 2 }; font6.Append(bold2); font6.Append(fontSize6); font6.Append(fontName6); font6.Append(fontFamilyNumbering4); Font font7 = new Font(); Bold bold3 = new Bold(); FontSize fontSize7 = new FontSize() { Val = 10D }; FontName fontName7 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering5 = new FontFamilyNumbering() { Val = 2 }; font7.Append(bold3); font7.Append(fontSize7); font7.Append(fontName7); font7.Append(fontFamilyNumbering5); Font font8 = new Font(); Bold bold4 = new Bold(); FontSize fontSize8 = new FontSize() { Val = 9D }; FontName fontName8 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering6 = new FontFamilyNumbering() { Val = 2 }; font8.Append(bold4); font8.Append(fontSize8); font8.Append(fontName8); font8.Append(fontFamilyNumbering6); Font font9 = new Font(); FontSize fontSize9 = new FontSize() { Val = 9D }; FontName fontName9 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering7 = new FontFamilyNumbering() { Val = 2 }; font9.Append(fontSize9); font9.Append(fontName9); font9.Append(fontFamilyNumbering7); Font font10 = new Font(); Bold bold5 = new Bold(); FontSize fontSize10 = new FontSize() { Val = 8D }; Color color1 = new Color() { Indexed = (UInt32Value)12U }; FontName fontName10 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering8 = new FontFamilyNumbering() { Val = 2 }; font10.Append(bold5); font10.Append(fontSize10); font10.Append(color1); font10.Append(fontName10); font10.Append(fontFamilyNumbering8); Font font11 = new Font(); Bold bold6 = new Bold(); FontSize fontSize11 = new FontSize() { Val = 9D }; Color color2 = new Color() { Indexed = (UInt32Value)9U }; FontName fontName11 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering9 = new FontFamilyNumbering() { Val = 2 }; font11.Append(bold6); font11.Append(fontSize11); font11.Append(color2); font11.Append(fontName11); font11.Append(fontFamilyNumbering9); Font font12 = new Font(); FontSize fontSize12 = new FontSize() { Val = 10D }; FontName fontName12 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering10 = new FontFamilyNumbering() { Val = 2 }; font12.Append(fontSize12); font12.Append(fontName12); font12.Append(fontFamilyNumbering10); Font font13 = new Font(); Bold bold7 = new Bold(); FontSize fontSize13 = new FontSize() { Val = 10D }; Color color3 = new Color() { Indexed = (UInt32Value)10U }; FontName fontName13 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering11 = new FontFamilyNumbering() { Val = 2 }; font13.Append(bold7); font13.Append(fontSize13); font13.Append(color3); font13.Append(fontName13); font13.Append(fontFamilyNumbering11); Font font14 = new Font(); FontSize fontSize14 = new FontSize() { Val = 10D }; Color color4 = new Color() { Indexed = (UInt32Value)8U }; FontName fontName14 = new FontName() { Val = "Tahoma" }; FontFamilyNumbering fontFamilyNumbering12 = new FontFamilyNumbering() { Val = 2 }; font14.Append(fontSize14); font14.Append(color4); font14.Append(fontName14); font14.Append(fontFamilyNumbering12); Font font15 = new Font(); Bold bold8 = new Bold(); FontSize fontSize15 = new FontSize() { Val = 12D }; Color color5 = new Color() { Indexed = (UInt32Value)10U }; FontName fontName15 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering13 = new FontFamilyNumbering() { Val = 2 }; font15.Append(bold8); font15.Append(fontSize15); font15.Append(color5); font15.Append(fontName15); font15.Append(fontFamilyNumbering13); Font font16 = new Font(); Bold bold9 = new Bold(); FontSize fontSize16 = new FontSize() { Val = 12D }; FontName fontName16 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering14 = new FontFamilyNumbering() { Val = 2 }; font16.Append(bold9); font16.Append(fontSize16); font16.Append(fontName16); font16.Append(fontFamilyNumbering14); Font font17 = new Font(); FontSize fontSize17 = new FontSize() { Val = 12D }; FontName fontName17 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering15 = new FontFamilyNumbering() { Val = 2 }; font17.Append(fontSize17); font17.Append(fontName17); font17.Append(fontFamilyNumbering15); fonts1.Append(font1); fonts1.Append(font2); fonts1.Append(font3); fonts1.Append(font4); fonts1.Append(font5); fonts1.Append(font6); fonts1.Append(font7); fonts1.Append(font8); fonts1.Append(font9); fonts1.Append(font10); fonts1.Append(font11); fonts1.Append(font12); fonts1.Append(font13); fonts1.Append(font14); fonts1.Append(font15); fonts1.Append(font16); fonts1.Append(font17); Fills fills1 = new Fills() { Count = (UInt32Value)4U }; Fill fill1 = new Fill(); PatternFill patternFill1 = new PatternFill() { PatternType = PatternValues.None }; fill1.Append(patternFill1); Fill fill2 = new Fill(); PatternFill patternFill2 = new PatternFill() { PatternType = PatternValues.Gray125 }; fill2.Append(patternFill2); Fill fill3 = new Fill(); PatternFill patternFill3 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor1 = new ForegroundColor() { Indexed = (UInt32Value)9U }; BackgroundColor backgroundColor1 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill3.Append(foregroundColor1); patternFill3.Append(backgroundColor1); fill3.Append(patternFill3); Fill fill4 = new Fill(); PatternFill patternFill4 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor2 = new ForegroundColor() { Indexed = (UInt32Value)63U }; BackgroundColor backgroundColor2 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill4.Append(foregroundColor2); patternFill4.Append(backgroundColor2); fill4.Append(patternFill4); fills1.Append(fill1); fills1.Append(fill2); fills1.Append(fill3); fills1.Append(fill4); Borders borders1 = new Borders() { Count = (UInt32Value)7U }; Border border1 = new Border(); LeftBorder leftBorder1 = new LeftBorder(); RightBorder rightBorder1 = new RightBorder(); TopBorder topBorder1 = new TopBorder(); BottomBorder bottomBorder1 = new BottomBorder(); DiagonalBorder diagonalBorder1 = new DiagonalBorder(); border1.Append(leftBorder1); border1.Append(rightBorder1); border1.Append(topBorder1); border1.Append(bottomBorder1); border1.Append(diagonalBorder1); Border border2 = new Border(); LeftBorder leftBorder2 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color6 = new Color() { Indexed = (UInt32Value)64U }; leftBorder2.Append(color6); RightBorder rightBorder2 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color7 = new Color() { Indexed = (UInt32Value)64U }; rightBorder2.Append(color7); TopBorder topBorder2 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color8 = new Color() { Indexed = (UInt32Value)64U }; topBorder2.Append(color8); BottomBorder bottomBorder2 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color9 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder2.Append(color9); DiagonalBorder diagonalBorder2 = new DiagonalBorder(); border2.Append(leftBorder2); border2.Append(rightBorder2); border2.Append(topBorder2); border2.Append(bottomBorder2); border2.Append(diagonalBorder2); Border border3 = new Border(); LeftBorder leftBorder3 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color10 = new Color() { Indexed = (UInt32Value)64U }; leftBorder3.Append(color10); RightBorder rightBorder3 = new RightBorder(); TopBorder topBorder3 = new TopBorder(); BottomBorder bottomBorder3 = new BottomBorder(); DiagonalBorder diagonalBorder3 = new DiagonalBorder(); border3.Append(leftBorder3); border3.Append(rightBorder3); border3.Append(topBorder3); border3.Append(bottomBorder3); border3.Append(diagonalBorder3); Border border4 = new Border(); LeftBorder leftBorder4 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color11 = new Color() { Indexed = (UInt32Value)64U }; leftBorder4.Append(color11); RightBorder rightBorder4 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color12 = new Color() { Indexed = (UInt32Value)64U }; rightBorder4.Append(color12); TopBorder topBorder4 = new TopBorder(); BottomBorder bottomBorder4 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color13 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder4.Append(color13); DiagonalBorder diagonalBorder4 = new DiagonalBorder(); border4.Append(leftBorder4); border4.Append(rightBorder4); border4.Append(topBorder4); border4.Append(bottomBorder4); border4.Append(diagonalBorder4); Border border5 = new Border(); LeftBorder leftBorder5 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color14 = new Color() { Indexed = (UInt32Value)64U }; leftBorder5.Append(color14); RightBorder rightBorder5 = new RightBorder(); TopBorder topBorder5 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color15 = new Color() { Indexed = (UInt32Value)64U }; topBorder5.Append(color15); BottomBorder bottomBorder5 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color16 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder5.Append(color16); DiagonalBorder diagonalBorder5 = new DiagonalBorder(); border5.Append(leftBorder5); border5.Append(rightBorder5); border5.Append(topBorder5); border5.Append(bottomBorder5); border5.Append(diagonalBorder5); Border border6 = new Border(); LeftBorder leftBorder6 = new LeftBorder() { Style = BorderStyleValues.Medium }; Color color17 = new Color() { Indexed = (UInt32Value)64U }; leftBorder6.Append(color17); RightBorder rightBorder6 = new RightBorder(); TopBorder topBorder6 = new TopBorder(); BottomBorder bottomBorder6 = new BottomBorder(); DiagonalBorder diagonalBorder6 = new DiagonalBorder(); border6.Append(leftBorder6); border6.Append(rightBorder6); border6.Append(topBorder6); border6.Append(bottomBorder6); border6.Append(diagonalBorder6); Border border7 = new Border(); LeftBorder leftBorder7 = new LeftBorder(); RightBorder rightBorder7 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color18 = new Color() { Indexed = (UInt32Value)64U }; rightBorder7.Append(color18); TopBorder topBorder7 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color19 = new Color() { Indexed = (UInt32Value)64U }; topBorder7.Append(color19); BottomBorder bottomBorder7 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color20 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder7.Append(color20); DiagonalBorder diagonalBorder7 = new DiagonalBorder(); border7.Append(leftBorder7); border7.Append(rightBorder7); border7.Append(topBorder7); border7.Append(bottomBorder7); border7.Append(diagonalBorder7); borders1.Append(border1); borders1.Append(border2); borders1.Append(border3); borders1.Append(border4); borders1.Append(border5); borders1.Append(border6); borders1.Append(border7); CellStyleFormats cellStyleFormats1 = new CellStyleFormats() { Count = (UInt32Value)2U }; CellFormat cellFormat1 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U }; CellFormat cellFormat2 = new CellFormat() { NumberFormatId = (UInt32Value)186U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, ApplyFont = false, ApplyFill = false, ApplyBorder = false, ApplyAlignment = false, ApplyProtection = false }; cellStyleFormats1.Append(cellFormat1); cellStyleFormats1.Append(cellFormat2); CellFormats cellFormats1 = new CellFormats() { Count = (UInt32Value)40U }; CellFormat cellFormat3 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; CellFormat cellFormat4 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true }; CellFormat cellFormat5 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)5U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat6 = new CellFormat() { NumberFormatId = (UInt32Value)49U, FontId = (UInt32Value)3U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment1 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; cellFormat6.Append(alignment1); CellFormat cellFormat7 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat8 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)8U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment2 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat8.Append(alignment2); CellFormat cellFormat9 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)8U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment3 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat9.Append(alignment3); CellFormat cellFormat10 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat11 = new CellFormat() { NumberFormatId = (UInt32Value)14U, FontId = (UInt32Value)5U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment4 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; cellFormat11.Append(alignment4); CellFormat cellFormat12 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)8U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment5 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat12.Append(alignment5); CellFormat cellFormat13 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat14 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)6U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment6 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat14.Append(alignment6); CellFormat cellFormat15 = new CellFormat() { NumberFormatId = (UInt32Value)14U, FontId = (UInt32Value)9U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment7 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; cellFormat15.Append(alignment7); CellFormat cellFormat16 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)10U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment8 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat16.Append(alignment8); CellFormat cellFormat17 = new CellFormat() { NumberFormatId = (UInt32Value)14U, FontId = (UInt32Value)10U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment9 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat17.Append(alignment9); CellFormat cellFormat18 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)11U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment10 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat18.Append(alignment10); CellFormat cellFormat19 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)12U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment11 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat19.Append(alignment11); CellFormat cellFormat20 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)13U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment12 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat20.Append(alignment12); CellFormat cellFormat21 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)10U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)3U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment13 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat21.Append(alignment13); CellFormat cellFormat22 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment14 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat22.Append(alignment14); CellFormat cellFormat23 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)11U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment15 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; cellFormat23.Append(alignment15); CellFormat cellFormat24 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)14U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment16 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat24.Append(alignment16); CellFormat cellFormat25 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)15U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat26 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)15U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment17 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat26.Append(alignment17); CellFormat cellFormat27 = new CellFormat() { NumberFormatId = (UInt32Value)194U, FontId = (UInt32Value)8U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment18 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat27.Append(alignment18); CellFormat cellFormat28 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)7U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment19 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat28.Append(alignment19); CellFormat cellFormat29 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)6U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat30 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)4U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment20 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat30.Append(alignment20); CellFormat cellFormat31 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)6U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)4U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment21 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat31.Append(alignment21); CellFormat cellFormat32 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)5U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat33 = new CellFormat() { NumberFormatId = (UInt32Value)186U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat34 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)15U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment22 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat34.Append(alignment22); CellFormat cellFormat35 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)4U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat36 = new CellFormat() { NumberFormatId = (UInt32Value)16U, FontId = (UInt32Value)8U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment23 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat36.Append(alignment23); CellFormat cellFormat37 = new CellFormat() { NumberFormatId = (UInt32Value)194U, FontId = (UInt32Value)10U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment24 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat37.Append(alignment24); CellFormat cellFormat38 = new CellFormat() { NumberFormatId = (UInt32Value)195U, FontId = (UInt32Value)8U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment25 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat38.Append(alignment25); CellFormat cellFormat39 = new CellFormat() { NumberFormatId = (UInt32Value)194U, FontId = (UInt32Value)11U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)6U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat40 = new CellFormat() { NumberFormatId = (UInt32Value)194U, FontId = (UInt32Value)6U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)6U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat41 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)5U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment26 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; cellFormat41.Append(alignment26); CellFormat cellFormat42 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)16U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment27 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat42.Append(alignment27); cellFormats1.Append(cellFormat3); cellFormats1.Append(cellFormat4); cellFormats1.Append(cellFormat5); cellFormats1.Append(cellFormat6); cellFormats1.Append(cellFormat7); cellFormats1.Append(cellFormat8); cellFormats1.Append(cellFormat9); cellFormats1.Append(cellFormat10); cellFormats1.Append(cellFormat11); cellFormats1.Append(cellFormat12); cellFormats1.Append(cellFormat13); cellFormats1.Append(cellFormat14); cellFormats1.Append(cellFormat15); cellFormats1.Append(cellFormat16); cellFormats1.Append(cellFormat17); cellFormats1.Append(cellFormat18); cellFormats1.Append(cellFormat19); cellFormats1.Append(cellFormat20); cellFormats1.Append(cellFormat21); cellFormats1.Append(cellFormat22); cellFormats1.Append(cellFormat23); cellFormats1.Append(cellFormat24); cellFormats1.Append(cellFormat25); cellFormats1.Append(cellFormat26); cellFormats1.Append(cellFormat27); cellFormats1.Append(cellFormat28); cellFormats1.Append(cellFormat29); cellFormats1.Append(cellFormat30); cellFormats1.Append(cellFormat31); cellFormats1.Append(cellFormat32); cellFormats1.Append(cellFormat33); cellFormats1.Append(cellFormat34); cellFormats1.Append(cellFormat35); cellFormats1.Append(cellFormat36); cellFormats1.Append(cellFormat37); cellFormats1.Append(cellFormat38); cellFormats1.Append(cellFormat39); cellFormats1.Append(cellFormat40); cellFormats1.Append(cellFormat41); cellFormats1.Append(cellFormat42); CellStyles cellStyles1 = new CellStyles() { Count = (UInt32Value)2U }; CellStyle cellStyle1 = new CellStyle() { Name = "Moneda", FormatId = (UInt32Value)1U, BuiltinId = (UInt32Value)4U }; CellStyle cellStyle2 = new CellStyle() { Name = "Normal", FormatId = (UInt32Value)0U, BuiltinId = (UInt32Value)0U }; cellStyles1.Append(cellStyle1); cellStyles1.Append(cellStyle2); DifferentialFormats differentialFormats1 = new DifferentialFormats() { Count = (UInt32Value)0U }; TableStyles tableStyles1 = new TableStyles() { Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium9", DefaultPivotStyle = "PivotStyleLight16" }; stylesheet1.Append(numberingFormats1); stylesheet1.Append(fonts1); stylesheet1.Append(fills1); stylesheet1.Append(borders1); stylesheet1.Append(cellStyleFormats1); stylesheet1.Append(cellFormats1); stylesheet1.Append(cellStyles1); stylesheet1.Append(differentialFormats1); stylesheet1.Append(tableStyles1); workbookStylesPart1.Stylesheet = stylesheet1; }
// Creates an Stylesheet instance and adds its children. public static Stylesheet GenerateStylesheet() { var stylesheet1 = new Stylesheet {MCAttributes = new MarkupCompatibilityAttributes {Ignorable = "x14ac"}}; stylesheet1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); stylesheet1.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"); var fonts1 = new Fonts {Count = 7U, KnownFonts = true}; var font1 = new Font(); var fontSize1 = new FontSize {Val = 11D}; var color1 = new Color {Theme = 1U}; var fontName1 = new FontName {Val = "Calibri"}; var fontFamilyNumbering1 = new FontFamilyNumbering {Val = 2}; var fontCharSet1 = new FontCharSet {Val = 204}; var fontScheme1 = new FontScheme {Val = FontSchemeValues.Minor}; font1.Append(fontSize1); font1.Append(color1); font1.Append(fontName1); font1.Append(fontFamilyNumbering1); font1.Append(fontCharSet1); font1.Append(fontScheme1); var font2 = new Font(); var bold1 = new Bold(); var fontSize2 = new FontSize {Val = 11D}; var color2 = new Color {Theme = 1U}; var fontName2 = new FontName {Val = "Calibri"}; var fontFamilyNumbering2 = new FontFamilyNumbering {Val = 2}; var fontCharSet2 = new FontCharSet {Val = 204}; var fontScheme2 = new FontScheme {Val = FontSchemeValues.Minor}; font2.Append(bold1); font2.Append(fontSize2); font2.Append(color2); font2.Append(fontName2); font2.Append(fontFamilyNumbering2); font2.Append(fontCharSet2); font2.Append(fontScheme2); var font3 = new Font(); var bold2 = new Bold(); var italic1 = new Italic(); var fontSize3 = new FontSize {Val = 11D}; var color3 = new Color {Theme = 1U}; var fontName3 = new FontName {Val = "Calibri"}; var fontFamilyNumbering3 = new FontFamilyNumbering {Val = 2}; var fontCharSet3 = new FontCharSet {Val = 204}; var fontScheme3 = new FontScheme {Val = FontSchemeValues.Minor}; font3.Append(bold2); font3.Append(italic1); font3.Append(fontSize3); font3.Append(color3); font3.Append(fontName3); font3.Append(fontFamilyNumbering3); font3.Append(fontCharSet3); font3.Append(fontScheme3); var font4 = new Font(); var bold3 = new Bold(); var fontSize4 = new FontSize {Val = 18D}; var color4 = new Color {Theme = 1U}; var fontName4 = new FontName {Val = "Calibri"}; var fontFamilyNumbering4 = new FontFamilyNumbering {Val = 2}; var fontCharSet4 = new FontCharSet {Val = 204}; var fontScheme4 = new FontScheme {Val = FontSchemeValues.Minor}; font4.Append(bold3); font4.Append(fontSize4); font4.Append(color4); font4.Append(fontName4); font4.Append(fontFamilyNumbering4); font4.Append(fontCharSet4); font4.Append(fontScheme4); var font5 = new Font(); var bold4 = new Bold(); var fontSize5 = new FontSize {Val = 11D}; var fontName5 = new FontName {Val = "Calibri"}; var fontFamilyNumbering5 = new FontFamilyNumbering {Val = 2}; var fontCharSet5 = new FontCharSet {Val = 204}; var fontScheme5 = new FontScheme {Val = FontSchemeValues.Minor}; font5.Append(bold4); font5.Append(fontSize5); font5.Append(fontName5); font5.Append(fontFamilyNumbering5); font5.Append(fontCharSet5); font5.Append(fontScheme5); var font6 = new Font(); var fontSize6 = new FontSize {Val = 11D}; var fontName6 = new FontName {Val = "Calibri"}; var fontFamilyNumbering6 = new FontFamilyNumbering {Val = 2}; var fontCharSet6 = new FontCharSet {Val = 204}; var fontScheme6 = new FontScheme {Val = FontSchemeValues.Minor}; font6.Append(fontSize6); font6.Append(fontName6); font6.Append(fontFamilyNumbering6); font6.Append(fontCharSet6); font6.Append(fontScheme6); var font7 = new Font(); var bold5 = new Bold(); var fontSize7 = new FontSize {Val = 12D}; var color5 = new Color {Theme = 1U}; var fontName7 = new FontName {Val = "Calibri"}; var fontFamilyNumbering7 = new FontFamilyNumbering {Val = 2}; var fontCharSet7 = new FontCharSet {Val = 204}; var fontScheme7 = new FontScheme {Val = FontSchemeValues.Minor}; font7.Append(bold5); font7.Append(fontSize7); font7.Append(color5); font7.Append(fontName7); font7.Append(fontFamilyNumbering7); font7.Append(fontCharSet7); font7.Append(fontScheme7); fonts1.Append(font1); fonts1.Append(font2); fonts1.Append(font3); fonts1.Append(font4); fonts1.Append(font5); fonts1.Append(font6); fonts1.Append(font7); var fills1 = new Fills {Count = 2U}; var fill1 = new Fill(); var patternFill1 = new PatternFill {PatternType = PatternValues.None}; fill1.Append(patternFill1); var fill2 = new Fill(); var patternFill2 = new PatternFill {PatternType = PatternValues.Gray125}; fill2.Append(patternFill2); fills1.Append(fill1); fills1.Append(fill2); var borders1 = new Borders {Count = 2U}; var border1 = new Border(); var leftBorder1 = new LeftBorder(); var rightBorder1 = new RightBorder(); var topBorder1 = new TopBorder(); var bottomBorder1 = new BottomBorder(); var diagonalBorder1 = new DiagonalBorder(); border1.Append(leftBorder1); border1.Append(rightBorder1); border1.Append(topBorder1); border1.Append(bottomBorder1); border1.Append(diagonalBorder1); var border2 = new Border(); var leftBorder2 = new LeftBorder {Style = BorderStyleValues.Thin}; var color6 = new Color {Indexed = 64U}; leftBorder2.Append(color6); var rightBorder2 = new RightBorder {Style = BorderStyleValues.Thin}; var color7 = new Color {Indexed = 64U}; rightBorder2.Append(color7); var topBorder2 = new TopBorder {Style = BorderStyleValues.Thin}; var color8 = new Color {Indexed = 64U}; topBorder2.Append(color8); var bottomBorder2 = new BottomBorder {Style = BorderStyleValues.Thin}; var color9 = new Color {Indexed = 64U}; bottomBorder2.Append(color9); var diagonalBorder2 = new DiagonalBorder(); border2.Append(leftBorder2); border2.Append(rightBorder2); border2.Append(topBorder2); border2.Append(bottomBorder2); border2.Append(diagonalBorder2); borders1.Append(border1); borders1.Append(border2); var cellStyleFormats1 = new CellStyleFormats {Count = 4U}; var cellFormat1 = new CellFormat {NumberFormatId = 0U, FontId = 0U, FillId = 0U, BorderId = 0U}; var cellFormat2 = new CellFormat { NumberFormatId = 0U, FontId = 5U, FillId = 0U, BorderId = 1U, ApplyNumberFormat = false, ApplyAlignment = false, ApplyProtection = false }; var cellFormat3 = new CellFormat { NumberFormatId = 0U, FontId = 4U, FillId = 0U, BorderId = 1U, ApplyNumberFormat = false, ApplyAlignment = false, ApplyProtection = false }; var cellFormat4 = new CellFormat {NumberFormatId = 0U, FontId = 6U, FillId = 0U, BorderId = 1U}; cellStyleFormats1.Append(cellFormat1); cellStyleFormats1.Append(cellFormat2); cellStyleFormats1.Append(cellFormat3); cellStyleFormats1.Append(cellFormat4); var cellFormats1 = new CellFormats {Count = 5U}; var cellFormat5 = new CellFormat { NumberFormatId = 0U, FontId = 0U, FillId = 0U, BorderId = 0U, FormatId = 0U }; var cellFormat6 = new CellFormat { NumberFormatId = 0U, FontId = 1U, FillId = 0U, BorderId = 0U, FormatId = 0U, ApplyFont = true }; var cellFormat7 = new CellFormat { NumberFormatId = 0U, FontId = 2U, FillId = 0U, BorderId = 0U, FormatId = 0U, ApplyFont = true, ApplyBorder = true }; var cellFormat8 = new CellFormat { NumberFormatId = 0U, FontId = 0U, FillId = 0U, BorderId = 0U, FormatId = 0U, ApplyAlignment = true }; var cellFormat9 = new CellFormat { NumberFormatId = 0U, FontId = 3U, FillId = 0U, BorderId = 0U, FormatId = 0U, ApplyFont = true, ApplyAlignment = true }; var alignment1 = new Alignment {Horizontal = HorizontalAlignmentValues.Center}; cellFormat9.Append(alignment1); cellFormats1.Append(cellFormat5); cellFormats1.Append(cellFormat6); cellFormats1.Append(cellFormat7); cellFormats1.Append(cellFormat8); cellFormats1.Append(cellFormat9); var cellStyles1 = new CellStyles {Count = 4U}; var cellStyle1 = new CellStyle {Name = "Custom", FormatId = 3U}; var cellStyle2 = new CellStyle {Name = "Нейтральный", FormatId = 2U, BuiltinId = 28U, CustomBuiltin = true}; var cellStyle3 = new CellStyle {Name = "Обычный", FormatId = 0U, BuiltinId = 0U}; var cellStyle4 = new CellStyle {Name = "Плохой", FormatId = 1U, BuiltinId = 27U, CustomBuiltin = true}; cellStyles1.Append(cellStyle1); cellStyles1.Append(cellStyle2); cellStyles1.Append(cellStyle3); cellStyles1.Append(cellStyle4); var differentialFormats1 = new DifferentialFormats {Count = 0U}; var tableStyles1 = new TableStyles { Count = 0U, DefaultTableStyle = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleLight16" }; var stylesheetExtensionList1 = new StylesheetExtensionList(); var stylesheetExtension1 = new StylesheetExtension {Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}"}; stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"); var slicerStyles1 = new X14.SlicerStyles {DefaultSlicerStyle = "SlicerStyleLight1"}; stylesheetExtension1.Append(slicerStyles1); stylesheetExtensionList1.Append(stylesheetExtension1); stylesheet1.Append(fonts1); stylesheet1.Append(fills1); stylesheet1.Append(borders1); stylesheet1.Append(cellStyleFormats1); stylesheet1.Append(cellFormats1); stylesheet1.Append(cellStyles1); stylesheet1.Append(differentialFormats1); stylesheet1.Append(tableStyles1); stylesheet1.Append(stylesheetExtensionList1); return stylesheet1; }
private static void CreateStyles(WorkbookPart workbookpart) { WorkbookStylesPart sp = workbookpart.AddNewPart <WorkbookStylesPart>(); sp.Stylesheet = new Stylesheet(); Fonts fonts = new Fonts() { Count = (UInt32Value)2U, KnownFonts = true }; Font fontUsual = new Font(); fontUsual.Append(new FontSize() { Val = 12D }); fontUsual.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Theme = (UInt32Value)1U }); fontUsual.Append(new FontName() { Val = "Times New Roman" }); fontUsual.Append(new FontFamilyNumbering() { Val = 2 }); fontUsual.Append(new FontScheme() { Val = FontSchemeValues.Minor }); Font fontTitle = new Font(); fontTitle.Append(new Bold()); fontTitle.Append(new FontSize() { Val = 14D }); fontTitle.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Theme = (UInt32Value)1U }); 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); Fills fills = new Fills() { Count = (UInt32Value)2U }; Fill fill1 = new Fill(); fill1.Append(new PatternFill() { PatternType = PatternValues.None }); Fill fill2 = new Fill(); fill2.Append(new PatternFill() { PatternType = PatternValues.Gray125 }); fills.Append(fill1); fills.Append(fill2); Borders borders = new Borders() { Count = (UInt32Value)2U }; Border borderNoBorder = new Border(); borderNoBorder.Append(new LeftBorder()); borderNoBorder.Append(new RightBorder()); borderNoBorder.Append(new TopBorder()); borderNoBorder.Append(new BottomBorder()); borderNoBorder.Append(new DiagonalBorder()); Border borderThin = new Border(); LeftBorder leftBorder = new LeftBorder() { Style = BorderStyleValues.Thin }; leftBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = (UInt32Value)64U }); RightBorder rightBorder = new RightBorder() { Style = BorderStyleValues.Thin }; rightBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = (UInt32Value)64U }); TopBorder topBorder = new TopBorder() { Style = BorderStyleValues.Thin }; topBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = (UInt32Value)64U }); BottomBorder bottomBorder = new BottomBorder() { Style = BorderStyleValues.Thin }; bottomBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = (UInt32Value)64U }); borderThin.Append(leftBorder); borderThin.Append(rightBorder); borderThin.Append(topBorder); borderThin.Append(bottomBorder); borderThin.Append(new DiagonalBorder()); borders.Append(borderNoBorder); borders.Append(borderThin); CellStyleFormats cellStyleFormats = new CellStyleFormats() { Count = (UInt32Value)1U }; CellFormat cellFormatStyle = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U }; cellStyleFormats.Append(cellFormatStyle); CellFormats cellFormats = new CellFormats() { Count = (UInt32Value)3U }; CellFormat cellFormatFont = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true }; CellFormat cellFormatFontAndBorder = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyBorder = true }; CellFormat cellFormatTitle = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, Alignment = new Alignment() { Vertical = VerticalAlignmentValues.Center, WrapText = true, Horizontal = HorizontalAlignmentValues.Center }, ApplyFont = true }; cellFormats.Append(cellFormatFont); cellFormats.Append(cellFormatFontAndBorder); cellFormats.Append(cellFormatTitle); CellStyles cellStyles = new CellStyles() { Count = (UInt32Value)1U }; cellStyles.Append(new CellStyle() { Name = "Normal", FormatId = (UInt32Value)0U, BuiltinId = (UInt32Value)0U }); DocumentFormat.OpenXml.Office2013.Excel.DifferentialFormats differentialFormats = new DocumentFormat.OpenXml.Office2013.Excel.DifferentialFormats() { Count = (UInt32Value)0U }; TableStyles tableStyles = new TableStyles() { Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleLight16" }; StylesheetExtensionList stylesheetExtensionList = new StylesheetExtensionList(); StylesheetExtension stylesheetExtension1 = new StylesheetExtension() { Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}" }; stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"); stylesheetExtension1.Append(new SlicerStyles() { DefaultSlicerStyle = "SlicerStyleLight1" }); StylesheetExtension stylesheetExtension2 = new StylesheetExtension() { Uri = "{9260A510-F301-46a8-8635-F512D64BE5F5}" }; stylesheetExtension2.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"); stylesheetExtension2.Append(new TimelineStyles() { DefaultTimelineStyle = "TimeSlicerStyleLight1" }); stylesheetExtensionList.Append(stylesheetExtension1); stylesheetExtensionList.Append(stylesheetExtension2); sp.Stylesheet.Append(fonts); sp.Stylesheet.Append(fills); sp.Stylesheet.Append(borders); sp.Stylesheet.Append(cellStyleFormats); sp.Stylesheet.Append(cellFormats); sp.Stylesheet.Append(cellStyles); sp.Stylesheet.Append(differentialFormats); sp.Stylesheet.Append(tableStyles); sp.Stylesheet.Append(stylesheetExtensionList); }
public CustomStylesheet() { Fonts fts = new Fonts(); Font ft = new Font(); FontName ftn = new FontName(); ftn.Val = StringValue.FromString("Calibri"); FontSize ftsz = new FontSize(); ftsz.Val = DoubleValue.FromDouble(11); ft.FontName = ftn; ft.FontSize = ftsz; fts.Append(ft); ft = new Font(); ftn = new FontName(); ftn.Val = StringValue.FromString("Palatino Linotype"); ftsz = new FontSize(); ftsz.Val = DoubleValue.FromDouble(18); ft.FontName = ftn; ft.FontSize = ftsz; fts.Append(ft); fts.Count = UInt32Value.FromUInt32((uint)fts.ChildElements.Count); Fills fills = new Fills(); Fill fill; PatternFill patternFill; fill = new Fill(); patternFill = new PatternFill(); patternFill.PatternType = PatternValues.None; fill.PatternFill = patternFill; fills.Append(fill); fill = new Fill(); patternFill = new PatternFill(); patternFill.PatternType = PatternValues.Gray125; fill.PatternFill = patternFill; fills.Append(fill); fill = new Fill(); patternFill = new PatternFill(); patternFill.PatternType = PatternValues.Solid; patternFill.ForegroundColor = new ForegroundColor(); patternFill.ForegroundColor.Rgb = HexBinaryValue.FromString("00ff9728"); patternFill.BackgroundColor = new BackgroundColor(); patternFill.BackgroundColor.Rgb = patternFill.ForegroundColor.Rgb; fill.PatternFill = patternFill; fills.Append(fill); fills.Count = UInt32Value.FromUInt32((uint)fills.ChildElements.Count); Borders borders = new Borders(); Border border = new Border(); border.LeftBorder = new LeftBorder(); border.RightBorder = new RightBorder(); border.TopBorder = new TopBorder(); border.BottomBorder = new BottomBorder(); border.DiagonalBorder = new DiagonalBorder(); borders.Append(border); //Boarder Index 1 border = new Border(); border.LeftBorder = new LeftBorder(); border.LeftBorder.Style = BorderStyleValues.Thin; border.RightBorder = new RightBorder(); border.RightBorder.Style = BorderStyleValues.Thin; border.TopBorder = new TopBorder(); border.TopBorder.Style = BorderStyleValues.Thin; border.BottomBorder = new BottomBorder(); border.BottomBorder.Style = BorderStyleValues.Thin; border.DiagonalBorder = new DiagonalBorder(); borders.Append(border); //Boarder Index 2 border = new Border(); border.LeftBorder = new LeftBorder(); border.RightBorder = new RightBorder(); border.TopBorder = new TopBorder(); border.TopBorder.Style = BorderStyleValues.Thin; border.BottomBorder = new BottomBorder(); border.BottomBorder.Style = BorderStyleValues.Thin; border.DiagonalBorder = new DiagonalBorder(); borders.Append(border); borders.Count = UInt32Value.FromUInt32((uint)borders.ChildElements.Count); CellStyleFormats csfs = new CellStyleFormats(); CellFormat cf = new CellFormat(); cf.NumberFormatId = 0; cf.FontId = 0; cf.FillId = 0; cf.BorderId = 0; csfs.Append(cf); csfs.Count = UInt32Value.FromUInt32((uint)csfs.ChildElements.Count); uint iExcelIndex = 164; NumberingFormats nfs = new NumberingFormats(); CellFormats cfs = new CellFormats(); cf = new CellFormat(); cf.NumberFormatId = 0; cf.FontId = 0; cf.FillId = 0; cf.BorderId = 0; cf.FormatId = 0; cfs.Append(cf); NumberingFormat nfDateTime = new NumberingFormat(); nfDateTime.NumberFormatId = UInt32Value.FromUInt32(iExcelIndex++); nfDateTime.FormatCode = StringValue.FromString("dd/mm/yyyy hh:mm:ss"); nfs.Append(nfDateTime); NumberingFormat nf4decimal = new NumberingFormat(); nf4decimal.NumberFormatId = UInt32Value.FromUInt32(iExcelIndex++); nf4decimal.FormatCode = StringValue.FromString("#,##0.0000"); nfs.Append(nf4decimal); // #,##0.00 is also Excel style index 4 NumberingFormat nf2decimal = new NumberingFormat(); nf2decimal.NumberFormatId = UInt32Value.FromUInt32(iExcelIndex++); nf2decimal.FormatCode = StringValue.FromString("#,##0.00"); nfs.Append(nf2decimal); // @ is also Excel style index 49 NumberingFormat nfForcedText = new NumberingFormat(); nfForcedText.NumberFormatId = UInt32Value.FromUInt32(iExcelIndex++); nfForcedText.FormatCode = StringValue.FromString("@"); nfs.Append(nfForcedText); // index 1 // Format dd/mm/yyyy cf = new CellFormat(); cf.NumberFormatId = 14; cf.FontId = 0; cf.FillId = 0; cf.BorderId = 0; cf.FormatId = 0; cf.ApplyNumberFormat = BooleanValue.FromBoolean(true); cfs.Append(cf); // index 2 // Format #,##0.00 cf = new CellFormat(); cf.NumberFormatId = 4; cf.FontId = 0; cf.FillId = 0; cf.BorderId = 0; cf.FormatId = 0; cf.ApplyNumberFormat = BooleanValue.FromBoolean(true); cfs.Append(cf); // index 3 cf = new CellFormat(); cf.NumberFormatId = nfDateTime.NumberFormatId; cf.FontId = 0; cf.FillId = 0; cf.BorderId = 0; cf.FormatId = 0; cf.ApplyNumberFormat = BooleanValue.FromBoolean(true); cfs.Append(cf); // index 4 cf = new CellFormat(); cf.NumberFormatId = nf4decimal.NumberFormatId; cf.FontId = 0; cf.FillId = 0; cf.BorderId = 0; cf.FormatId = 0; cf.ApplyNumberFormat = BooleanValue.FromBoolean(true); cfs.Append(cf); // index 5 cf = new CellFormat(); cf.NumberFormatId = nf2decimal.NumberFormatId; cf.FontId = 0; cf.FillId = 0; cf.BorderId = 0; cf.FormatId = 0; cf.ApplyNumberFormat = BooleanValue.FromBoolean(true); cfs.Append(cf); // index 6 cf = new CellFormat(); cf.NumberFormatId = nfForcedText.NumberFormatId; cf.FontId = 0; cf.FillId = 0; cf.BorderId = 0; cf.FormatId = 0; cf.ApplyNumberFormat = BooleanValue.FromBoolean(true); cfs.Append(cf); // index 7 // Header text cf = new CellFormat(); cf.NumberFormatId = nfForcedText.NumberFormatId; cf.FontId = 1; cf.FillId = 0; cf.BorderId = 0; cf.FormatId = 0; cf.ApplyNumberFormat = BooleanValue.FromBoolean(true); cfs.Append(cf); // index 8 // column text cf = new CellFormat(); cf.NumberFormatId = nfForcedText.NumberFormatId; cf.FontId = 0; cf.FillId = 0; cf.BorderId = 1; cf.FormatId = 0; cf.ApplyNumberFormat = BooleanValue.FromBoolean(true); cfs.Append(cf); // index 9 // coloured 2 decimal text cf = new CellFormat(); cf.NumberFormatId = nf2decimal.NumberFormatId; cf.FontId = 0; cf.FillId = 2; cf.BorderId = 2; cf.FormatId = 0; cf.ApplyNumberFormat = BooleanValue.FromBoolean(true); cfs.Append(cf); // index 10 // coloured column text cf = new CellFormat(); cf.NumberFormatId = nfForcedText.NumberFormatId; cf.FontId = 0; cf.FillId = 2; cf.BorderId = 2; cf.FormatId = 0; cf.ApplyNumberFormat = BooleanValue.FromBoolean(true); cfs.Append(cf); nfs.Count = UInt32Value.FromUInt32((uint)nfs.ChildElements.Count); cfs.Count = UInt32Value.FromUInt32((uint)cfs.ChildElements.Count); this.Append(nfs); this.Append(fts); this.Append(fills); this.Append(borders); this.Append(csfs); this.Append(cfs); CellStyles css = new CellStyles(); CellStyle cs = new CellStyle(); cs.Name = StringValue.FromString("Normal"); cs.FormatId = 0; cs.BuiltinId = 0; css.Append(cs); css.Count = UInt32Value.FromUInt32((uint)css.ChildElements.Count); this.Append(css); DifferentialFormats dfs = new DifferentialFormats(); dfs.Count = 0; this.Append(dfs); TableStyles tss = new TableStyles(); tss.Count = 0; tss.DefaultTableStyle = StringValue.FromString("TableStyleMedium9"); tss.DefaultPivotStyle = StringValue.FromString("PivotStyleLight16"); this.Append(tss); }
// Generates content of workbookStylesPart1. private void GenerateWorkbookStylesPart1Content(WorkbookStylesPart workbookStylesPart1) { // ReSharper disable PossiblyMistakenUseOfParamsMethod var stylesheet1 = new Stylesheet { MCAttributes = new MarkupCompatibilityAttributes { Ignorable = "x14ac" } }; stylesheet1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); stylesheet1.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"); var numberingFormats = new NumberingFormats(); // Datum var numberingFormat = new NumberingFormat { NumberFormatId = 14, FormatCode = StringValue.FromString("dd.mm.yyyy") }; numberingFormats.Append(numberingFormat); // Double var numberingFormatDouble = new NumberingFormat { NumberFormatId = 4, FormatCode = StringValue.FromString(NumberFormatDouble) }; numberingFormats.Append(numberingFormatDouble); var fonts = new Fonts { Count = 3U, KnownFonts = true }; fonts.Append(Font0()); fonts.Append(Font1()); fonts.Append(Font2()); fonts.Append(Font3()); var fills1 = new Fills { Count = 2U }; fills1.Append(Fill0()); fills1.Append(Fill1()); fills1.Append(Fill2()); fills1.Append(Fill3()); var borders1 = new Borders { Count = 2U }; borders1.Append(Border0()); borders1.Append(Border1()); var cellStyleFormats1 = new CellStyleFormats { Count = 1U }; cellStyleFormats1.Append(CellFormat0()); var cellFormats1 = new CellFormats { Count = 11U }; cellFormats1.Append(CellFormat0()); cellFormats1.Append(CellFormat1()); cellFormats1.Append(CellFormat2()); cellFormats1.Append(CellFormat3()); cellFormats1.Append(CellFormat4()); cellFormats1.Append(CellFormat5()); cellFormats1.Append(CellFormat6()); cellFormats1.Append(CellFormat7()); cellFormats1.Append(CellFormat8()); cellFormats1.Append(CellFormat9()); cellFormats1.Append(CellFormat10()); cellFormats1.Append(CellFormat11()); var cellStyles1 = new CellStyles { Count = 1U }; var cellStyle1 = new CellStyle { Name = "Standard", FormatId = 0U, BuiltinId = 0U, }; cellStyles1.Append(cellStyle1); var differentialFormats1 = new DifferentialFormats { Count = 0U }; var tableStyles1 = new TableStyles { Count = 0U, DefaultTableStyle = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleLight16" }; var stylesheetExtensionList1 = new StylesheetExtensionList(); var stylesheetExtension1 = new StylesheetExtension { Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}" }; stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"); var slicerStyles1 = new X14.SlicerStyles { DefaultSlicerStyle = "SlicerStyleLight1" }; stylesheetExtension1.Append(slicerStyles1); stylesheetExtensionList1.Append(stylesheetExtension1); stylesheet1.Append(numberingFormats); stylesheet1.Append(fonts); stylesheet1.Append(fills1); stylesheet1.Append(borders1); stylesheet1.Append(cellStyleFormats1); stylesheet1.Append(cellFormats1); stylesheet1.Append(cellStyles1); stylesheet1.Append(differentialFormats1); stylesheet1.Append(tableStyles1); stylesheet1.Append(stylesheetExtensionList1); workbookStylesPart1.Stylesheet = stylesheet1; // ReSharper restore PossiblyMistakenUseOfParamsMethod }
// Generates content of workbookStylesPart1. private void GenerateWorkbookStylesPart1Content(WorkbookStylesPart workbookStylesPart1) { Stylesheet stylesheet1 = new Stylesheet(); NumberingFormats numberingFormats1 = new NumberingFormats() { Count = (UInt32Value)2U }; NumberingFormat numberingFormat1 = new NumberingFormat() { NumberFormatId = (UInt32Value)164U, FormatCode = "_-* #,##0\\ _p_t_a_-;\\-* #,##0\\ _p_t_a_-;_-* \"-\"??\\ _p_t_a_-;_-@_-" }; NumberingFormat numberingFormat2 = new NumberingFormat() { NumberFormatId = (UInt32Value)165U, FormatCode = "_(\"$\"* #,##0_);_(\"$\"* \\(#,##0\\);_(\"$\"* \"-\"??_);_(@_)" }; numberingFormats1.Append(numberingFormat1); numberingFormats1.Append(numberingFormat2); Fonts fonts1 = new Fonts() { Count = (UInt32Value)17U }; Font font1 = new Font(); FontSize fontSize1 = new FontSize() { Val = 11D }; Color color1 = new Color() { Theme = (UInt32Value)1U }; FontName fontName1 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 }; FontScheme fontScheme1 = new FontScheme() { Val = FontSchemeValues.Minor }; font1.Append(fontSize1); font1.Append(color1); font1.Append(fontName1); font1.Append(fontFamilyNumbering1); font1.Append(fontScheme1); Font font2 = new Font(); FontSize fontSize2 = new FontSize() { Val = 10D }; FontName fontName2 = new FontName() { Val = "Times New Roman" }; font2.Append(fontSize2); font2.Append(fontName2); Font font3 = new Font(); Bold bold1 = new Bold(); FontSize fontSize3 = new FontSize() { Val = 8D }; FontName fontName3 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering2 = new FontFamilyNumbering() { Val = 2 }; font3.Append(bold1); font3.Append(fontSize3); font3.Append(fontName3); font3.Append(fontFamilyNumbering2); Font font4 = new Font(); FontSize fontSize4 = new FontSize() { Val = 8D }; FontName fontName4 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering3 = new FontFamilyNumbering() { Val = 2 }; font4.Append(fontSize4); font4.Append(fontName4); font4.Append(fontFamilyNumbering3); Font font5 = new Font(); FontSize fontSize5 = new FontSize() { Val = 10D }; FontName fontName5 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering4 = new FontFamilyNumbering() { Val = 2 }; font5.Append(fontSize5); font5.Append(fontName5); font5.Append(fontFamilyNumbering4); Font font6 = new Font(); Bold bold2 = new Bold(); FontSize fontSize6 = new FontSize() { Val = 9D }; Color color2 = new Color() { Indexed = (UInt32Value)9U }; FontName fontName6 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering5 = new FontFamilyNumbering() { Val = 2 }; font6.Append(bold2); font6.Append(fontSize6); font6.Append(color2); font6.Append(fontName6); font6.Append(fontFamilyNumbering5); Font font7 = new Font(); FontSize fontSize7 = new FontSize() { Val = 9D }; FontName fontName7 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering6 = new FontFamilyNumbering() { Val = 2 }; font7.Append(fontSize7); font7.Append(fontName7); font7.Append(fontFamilyNumbering6); Font font8 = new Font(); Bold bold3 = new Bold(); FontSize fontSize8 = new FontSize() { Val = 9D }; FontName fontName8 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering7 = new FontFamilyNumbering() { Val = 2 }; font8.Append(bold3); font8.Append(fontSize8); font8.Append(fontName8); font8.Append(fontFamilyNumbering7); Font font9 = new Font(); Bold bold4 = new Bold(); FontSize fontSize9 = new FontSize() { Val = 9D }; Color color3 = new Color() { Indexed = (UInt32Value)10U }; FontName fontName9 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering8 = new FontFamilyNumbering() { Val = 2 }; font9.Append(bold4); font9.Append(fontSize9); font9.Append(color3); font9.Append(fontName9); font9.Append(fontFamilyNumbering8); Font font10 = new Font(); Underline underline1 = new Underline(); FontSize fontSize10 = new FontSize() { Val = 9D }; Color color4 = new Color() { Indexed = (UInt32Value)12U }; FontName fontName10 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering9 = new FontFamilyNumbering() { Val = 2 }; font10.Append(underline1); font10.Append(fontSize10); font10.Append(color4); font10.Append(fontName10); font10.Append(fontFamilyNumbering9); Font font11 = new Font(); Bold bold5 = new Bold(); FontSize fontSize11 = new FontSize() { Val = 9D }; Color color5 = new Color() { Indexed = (UInt32Value)12U }; FontName fontName11 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering10 = new FontFamilyNumbering() { Val = 2 }; font11.Append(bold5); font11.Append(fontSize11); font11.Append(color5); font11.Append(fontName11); font11.Append(fontFamilyNumbering10); Font font12 = new Font(); FontSize fontSize12 = new FontSize() { Val = 11D }; FontName fontName12 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering11 = new FontFamilyNumbering() { Val = 2 }; font12.Append(fontSize12); font12.Append(fontName12); font12.Append(fontFamilyNumbering11); Font font13 = new Font(); FontSize fontSize13 = new FontSize() { Val = 10D }; Color color6 = new Color() { Indexed = (UInt32Value)8U }; FontName fontName13 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering12 = new FontFamilyNumbering() { Val = 2 }; font13.Append(fontSize13); font13.Append(color6); font13.Append(fontName13); font13.Append(fontFamilyNumbering12); Font font14 = new Font(); Bold bold6 = new Bold(); FontSize fontSize14 = new FontSize() { Val = 10D }; FontName fontName14 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering13 = new FontFamilyNumbering() { Val = 2 }; font14.Append(bold6); font14.Append(fontSize14); font14.Append(fontName14); font14.Append(fontFamilyNumbering13); Font font15 = new Font(); Bold bold7 = new Bold(); FontSize fontSize15 = new FontSize() { Val = 10D }; Color color7 = new Color() { Indexed = (UInt32Value)9U }; FontName fontName15 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering14 = new FontFamilyNumbering() { Val = 2 }; font15.Append(bold7); font15.Append(fontSize15); font15.Append(color7); font15.Append(fontName15); font15.Append(fontFamilyNumbering14); Font font16 = new Font(); Bold bold8 = new Bold(); FontSize fontSize16 = new FontSize() { Val = 8D }; Color color8 = new Color() { Indexed = (UInt32Value)9U }; FontName fontName16 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering15 = new FontFamilyNumbering() { Val = 2 }; font16.Append(bold8); font16.Append(fontSize16); font16.Append(color8); font16.Append(fontName16); font16.Append(fontFamilyNumbering15); Font font17 = new Font(); Bold bold9 = new Bold(); FontSize fontSize17 = new FontSize() { Val = 15D }; FontName fontName17 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering16 = new FontFamilyNumbering() { Val = 2 }; font17.Append(bold9); font17.Append(fontSize17); font17.Append(fontName17); font17.Append(fontFamilyNumbering16); fonts1.Append(font1); fonts1.Append(font2); fonts1.Append(font3); fonts1.Append(font4); fonts1.Append(font5); fonts1.Append(font6); fonts1.Append(font7); fonts1.Append(font8); fonts1.Append(font9); fonts1.Append(font10); fonts1.Append(font11); fonts1.Append(font12); fonts1.Append(font13); fonts1.Append(font14); fonts1.Append(font15); fonts1.Append(font16); fonts1.Append(font17); Fills fills1 = new Fills() { Count = (UInt32Value)8U }; Fill fill1 = new Fill(); PatternFill patternFill1 = new PatternFill() { PatternType = PatternValues.None }; fill1.Append(patternFill1); Fill fill2 = new Fill(); PatternFill patternFill2 = new PatternFill() { PatternType = PatternValues.Gray125 }; fill2.Append(patternFill2); Fill fill3 = new Fill(); PatternFill patternFill3 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor1 = new ForegroundColor() { Indexed = (UInt32Value)9U }; BackgroundColor backgroundColor1 = new BackgroundColor() { Indexed = (UInt32Value)26U }; patternFill3.Append(foregroundColor1); patternFill3.Append(backgroundColor1); fill3.Append(patternFill3); Fill fill4 = new Fill(); PatternFill patternFill4 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor2 = new ForegroundColor() { Indexed = (UInt32Value)10U }; BackgroundColor backgroundColor2 = new BackgroundColor() { Indexed = (UInt32Value)26U }; patternFill4.Append(foregroundColor2); patternFill4.Append(backgroundColor2); fill4.Append(patternFill4); Fill fill5 = new Fill(); PatternFill patternFill5 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor3 = new ForegroundColor() { Indexed = (UInt32Value)23U }; BackgroundColor backgroundColor3 = new BackgroundColor() { Indexed = (UInt32Value)26U }; patternFill5.Append(foregroundColor3); patternFill5.Append(backgroundColor3); fill5.Append(patternFill5); Fill fill6 = new Fill(); PatternFill patternFill6 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor4 = new ForegroundColor() { Theme = (UInt32Value)0U }; BackgroundColor backgroundColor4 = new BackgroundColor() { Indexed = (UInt32Value)26U }; patternFill6.Append(foregroundColor4); patternFill6.Append(backgroundColor4); fill6.Append(patternFill6); Fill fill7 = new Fill(); PatternFill patternFill7 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor5 = new ForegroundColor() { Theme = (UInt32Value)0U }; BackgroundColor backgroundColor5 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill7.Append(foregroundColor5); patternFill7.Append(backgroundColor5); fill7.Append(patternFill7); Fill fill8 = new Fill(); PatternFill patternFill8 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor6 = new ForegroundColor() { Theme = (UInt32Value)0U }; BackgroundColor backgroundColor6 = new BackgroundColor() { Rgb = "FFFFFFCC" }; patternFill8.Append(foregroundColor6); patternFill8.Append(backgroundColor6); fill8.Append(patternFill8); fills1.Append(fill1); fills1.Append(fill2); fills1.Append(fill3); fills1.Append(fill4); fills1.Append(fill5); fills1.Append(fill6); fills1.Append(fill7); fills1.Append(fill8); Borders borders1 = new Borders() { Count = (UInt32Value)14U }; Border border1 = new Border(); LeftBorder leftBorder1 = new LeftBorder(); RightBorder rightBorder1 = new RightBorder(); TopBorder topBorder1 = new TopBorder(); BottomBorder bottomBorder1 = new BottomBorder(); DiagonalBorder diagonalBorder1 = new DiagonalBorder(); border1.Append(leftBorder1); border1.Append(rightBorder1); border1.Append(topBorder1); border1.Append(bottomBorder1); border1.Append(diagonalBorder1); Border border2 = new Border(); LeftBorder leftBorder2 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color9 = new Color() { Indexed = (UInt32Value)64U }; leftBorder2.Append(color9); RightBorder rightBorder2 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color10 = new Color() { Indexed = (UInt32Value)64U }; rightBorder2.Append(color10); TopBorder topBorder2 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color11 = new Color() { Indexed = (UInt32Value)64U }; topBorder2.Append(color11); BottomBorder bottomBorder2 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color12 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder2.Append(color12); DiagonalBorder diagonalBorder2 = new DiagonalBorder(); border2.Append(leftBorder2); border2.Append(rightBorder2); border2.Append(topBorder2); border2.Append(bottomBorder2); border2.Append(diagonalBorder2); Border border3 = new Border(); LeftBorder leftBorder3 = new LeftBorder(); RightBorder rightBorder3 = new RightBorder(); TopBorder topBorder3 = new TopBorder() { Style = BorderStyleValues.Medium }; Color color13 = new Color() { Indexed = (UInt32Value)64U }; topBorder3.Append(color13); BottomBorder bottomBorder3 = new BottomBorder() { Style = BorderStyleValues.Medium }; Color color14 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder3.Append(color14); DiagonalBorder diagonalBorder3 = new DiagonalBorder(); border3.Append(leftBorder3); border3.Append(rightBorder3); border3.Append(topBorder3); border3.Append(bottomBorder3); border3.Append(diagonalBorder3); Border border4 = new Border(); LeftBorder leftBorder4 = new LeftBorder(); RightBorder rightBorder4 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color15 = new Color() { Indexed = (UInt32Value)64U }; rightBorder4.Append(color15); TopBorder topBorder4 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color16 = new Color() { Indexed = (UInt32Value)64U }; topBorder4.Append(color16); BottomBorder bottomBorder4 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color17 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder4.Append(color17); DiagonalBorder diagonalBorder4 = new DiagonalBorder(); border4.Append(leftBorder4); border4.Append(rightBorder4); border4.Append(topBorder4); border4.Append(bottomBorder4); border4.Append(diagonalBorder4); Border border5 = new Border(); LeftBorder leftBorder5 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color18 = new Color() { Indexed = (UInt32Value)64U }; leftBorder5.Append(color18); RightBorder rightBorder5 = new RightBorder(); TopBorder topBorder5 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color19 = new Color() { Indexed = (UInt32Value)64U }; topBorder5.Append(color19); BottomBorder bottomBorder5 = new BottomBorder(); DiagonalBorder diagonalBorder5 = new DiagonalBorder(); border5.Append(leftBorder5); border5.Append(rightBorder5); border5.Append(topBorder5); border5.Append(bottomBorder5); border5.Append(diagonalBorder5); Border border6 = new Border(); LeftBorder leftBorder6 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color20 = new Color() { Indexed = (UInt32Value)64U }; leftBorder6.Append(color20); RightBorder rightBorder6 = new RightBorder(); TopBorder topBorder6 = new TopBorder(); BottomBorder bottomBorder6 = new BottomBorder(); DiagonalBorder diagonalBorder6 = new DiagonalBorder(); border6.Append(leftBorder6); border6.Append(rightBorder6); border6.Append(topBorder6); border6.Append(bottomBorder6); border6.Append(diagonalBorder6); Border border7 = new Border(); LeftBorder leftBorder7 = new LeftBorder(); RightBorder rightBorder7 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color21 = new Color() { Indexed = (UInt32Value)64U }; rightBorder7.Append(color21); TopBorder topBorder7 = new TopBorder(); BottomBorder bottomBorder7 = new BottomBorder(); DiagonalBorder diagonalBorder7 = new DiagonalBorder(); border7.Append(leftBorder7); border7.Append(rightBorder7); border7.Append(topBorder7); border7.Append(bottomBorder7); border7.Append(diagonalBorder7); Border border8 = new Border(); LeftBorder leftBorder8 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color22 = new Color() { Indexed = (UInt32Value)64U }; leftBorder8.Append(color22); RightBorder rightBorder8 = new RightBorder(); TopBorder topBorder8 = new TopBorder() { Style = BorderStyleValues.Medium }; Color color23 = new Color() { Indexed = (UInt32Value)64U }; topBorder8.Append(color23); BottomBorder bottomBorder8 = new BottomBorder() { Style = BorderStyleValues.Medium }; Color color24 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder8.Append(color24); DiagonalBorder diagonalBorder8 = new DiagonalBorder(); border8.Append(leftBorder8); border8.Append(rightBorder8); border8.Append(topBorder8); border8.Append(bottomBorder8); border8.Append(diagonalBorder8); Border border9 = new Border(); LeftBorder leftBorder9 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color25 = new Color() { Indexed = (UInt32Value)64U }; leftBorder9.Append(color25); RightBorder rightBorder9 = new RightBorder(); TopBorder topBorder9 = new TopBorder(); BottomBorder bottomBorder9 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color26 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder9.Append(color26); DiagonalBorder diagonalBorder9 = new DiagonalBorder(); border9.Append(leftBorder9); border9.Append(rightBorder9); border9.Append(topBorder9); border9.Append(bottomBorder9); border9.Append(diagonalBorder9); Border border10 = new Border(); LeftBorder leftBorder10 = new LeftBorder(); RightBorder rightBorder10 = new RightBorder(); TopBorder topBorder10 = new TopBorder(); BottomBorder bottomBorder10 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color27 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder10.Append(color27); DiagonalBorder diagonalBorder10 = new DiagonalBorder(); border10.Append(leftBorder10); border10.Append(rightBorder10); border10.Append(topBorder10); border10.Append(bottomBorder10); border10.Append(diagonalBorder10); Border border11 = new Border(); LeftBorder leftBorder11 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color28 = new Color() { Indexed = (UInt32Value)64U }; leftBorder11.Append(color28); RightBorder rightBorder11 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color29 = new Color() { Indexed = (UInt32Value)64U }; rightBorder11.Append(color29); TopBorder topBorder11 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color30 = new Color() { Indexed = (UInt32Value)64U }; topBorder11.Append(color30); BottomBorder bottomBorder11 = new BottomBorder(); DiagonalBorder diagonalBorder11 = new DiagonalBorder(); border11.Append(leftBorder11); border11.Append(rightBorder11); border11.Append(topBorder11); border11.Append(bottomBorder11); border11.Append(diagonalBorder11); Border border12 = new Border(); LeftBorder leftBorder12 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color31 = new Color() { Indexed = (UInt32Value)64U }; leftBorder12.Append(color31); RightBorder rightBorder12 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color32 = new Color() { Indexed = (UInt32Value)64U }; rightBorder12.Append(color32); TopBorder topBorder12 = new TopBorder(); BottomBorder bottomBorder12 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color33 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder12.Append(color33); DiagonalBorder diagonalBorder12 = new DiagonalBorder(); border12.Append(leftBorder12); border12.Append(rightBorder12); border12.Append(topBorder12); border12.Append(bottomBorder12); border12.Append(diagonalBorder12); Border border13 = new Border(); LeftBorder leftBorder13 = new LeftBorder(); RightBorder rightBorder13 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color34 = new Color() { Indexed = (UInt32Value)64U }; rightBorder13.Append(color34); TopBorder topBorder13 = new TopBorder(); BottomBorder bottomBorder13 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color35 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder13.Append(color35); DiagonalBorder diagonalBorder13 = new DiagonalBorder(); border13.Append(leftBorder13); border13.Append(rightBorder13); border13.Append(topBorder13); border13.Append(bottomBorder13); border13.Append(diagonalBorder13); Border border14 = new Border(); LeftBorder leftBorder14 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color36 = new Color() { Indexed = (UInt32Value)64U }; leftBorder14.Append(color36); RightBorder rightBorder14 = new RightBorder(); TopBorder topBorder14 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color37 = new Color() { Indexed = (UInt32Value)64U }; topBorder14.Append(color37); BottomBorder bottomBorder14 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color38 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder14.Append(color38); DiagonalBorder diagonalBorder14 = new DiagonalBorder(); border14.Append(leftBorder14); border14.Append(rightBorder14); border14.Append(topBorder14); border14.Append(bottomBorder14); border14.Append(diagonalBorder14); borders1.Append(border1); borders1.Append(border2); borders1.Append(border3); borders1.Append(border4); borders1.Append(border5); borders1.Append(border6); borders1.Append(border7); borders1.Append(border8); borders1.Append(border9); borders1.Append(border10); borders1.Append(border11); borders1.Append(border12); borders1.Append(border13); borders1.Append(border14); CellStyleFormats cellStyleFormats1 = new CellStyleFormats() { Count = (UInt32Value)2U }; CellFormat cellFormat1 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U }; CellFormat cellFormat2 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U }; cellStyleFormats1.Append(cellFormat1); cellStyleFormats1.Append(cellFormat2); CellFormats cellFormats1 = new CellFormats() { Count = (UInt32Value)48U }; CellFormat cellFormat3 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; CellFormat cellFormat4 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyProtection = true }; Protection protection1 = new Protection() { Locked = false }; cellFormat4.Append(protection1); CellFormat cellFormat5 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyProtection = true }; Protection protection2 = new Protection() { Locked = false }; cellFormat5.Append(protection2); CellFormat cellFormat6 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)6U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyProtection = true }; Protection protection3 = new Protection() { Locked = false }; cellFormat6.Append(protection3); CellFormat cellFormat7 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)7U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)6U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyProtection = true }; Protection protection4 = new Protection() { Locked = false }; cellFormat7.Append(protection4); CellFormat cellFormat8 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)6U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)5U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment1 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; Protection protection5 = new Protection() { Locked = false }; cellFormat8.Append(alignment1); cellFormat8.Append(protection5); CellFormat cellFormat9 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)6U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyProtection = true }; Protection protection6 = new Protection() { Locked = false }; cellFormat9.Append(protection6); CellFormat cellFormat10 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)7U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)6U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyProtection = true }; Protection protection7 = new Protection() { Locked = false }; cellFormat10.Append(protection7); CellFormat cellFormat11 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)5U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)4U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment2 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; Protection protection8 = new Protection() { Locked = false }; cellFormat11.Append(alignment2); cellFormat11.Append(protection8); CellFormat cellFormat12 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)5U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)10U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment3 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; Protection protection9 = new Protection() { Locked = false }; cellFormat12.Append(alignment3); cellFormat12.Append(protection9); CellFormat cellFormat13 = new CellFormat() { NumberFormatId = (UInt32Value)16U, FontId = (UInt32Value)5U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)11U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment4 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; Protection protection10 = new Protection() { Locked = false }; cellFormat13.Append(alignment4); cellFormat13.Append(protection10); CellFormat cellFormat14 = new CellFormat() { NumberFormatId = (UInt32Value)20U, FontId = (UInt32Value)4U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)11U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment5 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; Protection protection11 = new Protection() { Locked = false }; cellFormat14.Append(alignment5); cellFormat14.Append(protection11); CellFormat cellFormat15 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)6U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment6 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; Protection protection12 = new Protection() { Locked = false }; cellFormat15.Append(alignment6); cellFormat15.Append(protection12); CellFormat cellFormat16 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)14U, FillId = (UInt32Value)4U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment7 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; Protection protection13 = new Protection() { Locked = false }; cellFormat16.Append(alignment7); cellFormat16.Append(protection13); CellFormat cellFormat17 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)5U, FillId = (UInt32Value)4U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment8 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; Protection protection14 = new Protection() { Locked = false }; cellFormat17.Append(alignment8); cellFormat17.Append(protection14); CellFormat cellFormat18 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)13U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)6U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment9 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; Protection protection15 = new Protection() { Locked = false }; cellFormat18.Append(alignment9); cellFormat18.Append(protection15); CellFormat cellFormat19 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)6U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)8U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyProtection = true }; Protection protection16 = new Protection() { Locked = false }; cellFormat19.Append(protection16); CellFormat cellFormat20 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)6U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)9U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyProtection = true }; Protection protection17 = new Protection() { Locked = false }; cellFormat20.Append(protection17); CellFormat cellFormat21 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)7U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyProtection = true }; Protection protection18 = new Protection() { Locked = false }; cellFormat21.Append(protection18); CellFormat cellFormat22 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)6U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyProtection = true }; Protection protection19 = new Protection() { Locked = false }; cellFormat22.Append(protection19); CellFormat cellFormat23 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)7U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)6U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyProtection = true }; Protection protection20 = new Protection() { Locked = false }; cellFormat23.Append(protection20); CellFormat cellFormat24 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)6U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyProtection = true }; Protection protection21 = new Protection() { Locked = false }; cellFormat24.Append(protection21); CellFormat cellFormat25 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)13U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)13U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment10 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; Protection protection22 = new Protection() { Locked = false }; cellFormat25.Append(alignment10); cellFormat25.Append(protection22); CellFormat cellFormat26 = new CellFormat() { NumberFormatId = (UInt32Value)164U, FontId = (UInt32Value)13U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)3U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment11 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; Protection protection23 = new Protection() { Locked = false }; cellFormat26.Append(alignment11); cellFormat26.Append(protection23); CellFormat cellFormat27 = new CellFormat() { NumberFormatId = (UInt32Value)165U, FontId = (UInt32Value)13U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)3U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyProtection = true }; Protection protection24 = new Protection() { Locked = false }; cellFormat27.Append(protection24); CellFormat cellFormat28 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)4U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment12 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; Protection protection25 = new Protection() { Locked = false }; cellFormat28.Append(alignment12); cellFormat28.Append(protection25); CellFormat cellFormat29 = new CellFormat() { NumberFormatId = (UInt32Value)9U, FontId = (UInt32Value)13U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)13U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment13 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; Protection protection26 = new Protection() { Locked = false }; cellFormat29.Append(alignment13); cellFormat29.Append(protection26); CellFormat cellFormat30 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)6U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)9U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyProtection = true }; Protection protection27 = new Protection() { Locked = false }; cellFormat30.Append(protection27); CellFormat cellFormat31 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)7U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)12U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyProtection = true }; Protection protection28 = new Protection() { Locked = false }; cellFormat31.Append(protection28); CellFormat cellFormat32 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)6U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)5U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment14 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; Protection protection29 = new Protection() { Locked = false }; cellFormat32.Append(alignment14); cellFormat32.Append(protection29); CellFormat cellFormat33 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)7U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)6U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyProtection = true }; Protection protection30 = new Protection() { Locked = false }; cellFormat33.Append(protection30); CellFormat cellFormat34 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)5U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyProtection = true }; Protection protection31 = new Protection() { Locked = false }; cellFormat34.Append(protection31); CellFormat cellFormat35 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyProtection = true }; Protection protection32 = new Protection() { Locked = false }; cellFormat35.Append(protection32); CellFormat cellFormat36 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)4U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment15 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; Protection protection33 = new Protection() { Locked = false }; cellFormat36.Append(alignment15); cellFormat36.Append(protection33); CellFormat cellFormat37 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)7U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyProtection = true }; Protection protection34 = new Protection() { Locked = false }; cellFormat37.Append(protection34); CellFormat cellFormat38 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyProtection = true }; Protection protection35 = new Protection() { Locked = false }; cellFormat38.Append(protection35); CellFormat cellFormat39 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)16U, FillId = (UInt32Value)7U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment16 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center }; Protection protection36 = new Protection() { Locked = false }; cellFormat39.Append(alignment16); cellFormat39.Append(protection36); CellFormat cellFormat40 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)15U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyProtection = true }; Protection protection37 = new Protection() { Locked = false }; cellFormat40.Append(protection37); CellFormat cellFormat41 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)6U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyProtection = true }; Protection protection38 = new Protection() { Locked = false }; cellFormat41.Append(protection38); CellFormat cellFormat42 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)8U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment17 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; Protection protection39 = new Protection() { Locked = false }; cellFormat42.Append(alignment17); cellFormat42.Append(protection39); CellFormat cellFormat43 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)8U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment18 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; Protection protection40 = new Protection() { Locked = false }; cellFormat43.Append(alignment18); cellFormat43.Append(protection40); CellFormat cellFormat44 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)7U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyProtection = true }; Protection protection41 = new Protection() { Locked = false }; cellFormat44.Append(protection41); CellFormat cellFormat45 = new CellFormat() { NumberFormatId = (UInt32Value)17U, FontId = (UInt32Value)10U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment19 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; Protection protection42 = new Protection() { Locked = false }; cellFormat45.Append(alignment19); cellFormat45.Append(protection42); CellFormat cellFormat46 = new CellFormat() { NumberFormatId = (UInt32Value)17U, FontId = (UInt32Value)7U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment20 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; Protection protection43 = new Protection() { Locked = false }; cellFormat46.Append(alignment20); cellFormat46.Append(protection43); CellFormat cellFormat47 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)12U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyProtection = true }; Protection protection44 = new Protection() { Locked = false }; cellFormat47.Append(protection44); CellFormat cellFormat48 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)9U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyProtection = true }; Protection protection45 = new Protection() { Locked = false }; cellFormat48.Append(protection45); CellFormat cellFormat49 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)11U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyProtection = true }; Protection protection46 = new Protection() { Locked = false }; cellFormat49.Append(protection46); CellFormat cellFormat50 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)6U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment21 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; Protection protection47 = new Protection() { Locked = false }; cellFormat50.Append(alignment21); cellFormat50.Append(protection47); cellFormats1.Append(cellFormat3); cellFormats1.Append(cellFormat4); cellFormats1.Append(cellFormat5); cellFormats1.Append(cellFormat6); cellFormats1.Append(cellFormat7); cellFormats1.Append(cellFormat8); cellFormats1.Append(cellFormat9); cellFormats1.Append(cellFormat10); cellFormats1.Append(cellFormat11); cellFormats1.Append(cellFormat12); cellFormats1.Append(cellFormat13); cellFormats1.Append(cellFormat14); cellFormats1.Append(cellFormat15); cellFormats1.Append(cellFormat16); cellFormats1.Append(cellFormat17); cellFormats1.Append(cellFormat18); cellFormats1.Append(cellFormat19); cellFormats1.Append(cellFormat20); cellFormats1.Append(cellFormat21); cellFormats1.Append(cellFormat22); cellFormats1.Append(cellFormat23); cellFormats1.Append(cellFormat24); cellFormats1.Append(cellFormat25); cellFormats1.Append(cellFormat26); cellFormats1.Append(cellFormat27); cellFormats1.Append(cellFormat28); cellFormats1.Append(cellFormat29); cellFormats1.Append(cellFormat30); cellFormats1.Append(cellFormat31); cellFormats1.Append(cellFormat32); cellFormats1.Append(cellFormat33); cellFormats1.Append(cellFormat34); cellFormats1.Append(cellFormat35); cellFormats1.Append(cellFormat36); cellFormats1.Append(cellFormat37); cellFormats1.Append(cellFormat38); cellFormats1.Append(cellFormat39); cellFormats1.Append(cellFormat40); cellFormats1.Append(cellFormat41); cellFormats1.Append(cellFormat42); cellFormats1.Append(cellFormat43); cellFormats1.Append(cellFormat44); cellFormats1.Append(cellFormat45); cellFormats1.Append(cellFormat46); cellFormats1.Append(cellFormat47); cellFormats1.Append(cellFormat48); cellFormats1.Append(cellFormat49); cellFormats1.Append(cellFormat50); CellStyles cellStyles1 = new CellStyles() { Count = (UInt32Value)2U }; CellStyle cellStyle1 = new CellStyle() { Name = "Normal", FormatId = (UInt32Value)0U, BuiltinId = (UInt32Value)0U }; CellStyle cellStyle2 = new CellStyle() { Name = "Normal 2", FormatId = (UInt32Value)1U }; cellStyles1.Append(cellStyle1); cellStyles1.Append(cellStyle2); DifferentialFormats differentialFormats1 = new DifferentialFormats() { Count = (UInt32Value)0U }; TableStyles tableStyles1 = new TableStyles() { Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium9", DefaultPivotStyle = "PivotStyleLight16" }; stylesheet1.Append(numberingFormats1); stylesheet1.Append(fonts1); stylesheet1.Append(fills1); stylesheet1.Append(borders1); stylesheet1.Append(cellStyleFormats1); stylesheet1.Append(cellFormats1); stylesheet1.Append(cellStyles1); stylesheet1.Append(differentialFormats1); stylesheet1.Append(tableStyles1); workbookStylesPart1.Stylesheet = stylesheet1; }
private Stylesheet GenerateStylesheet() { Stylesheet styleSheet = null; Fills fills = new Fills( new Fill(new PatternFill() { PatternType = PatternValues.None }), new Fill(new PatternFill(new ForegroundColor { Rgb = new HexBinaryValue("#ccffff") }) { PatternType = PatternValues.Solid }), new Fill(new PatternFill(new ForegroundColor { Rgb = new HexBinaryValue("#F5F6CE") }) { PatternType = PatternValues.Solid }), new Fill(new PatternFill(new ForegroundColor { Rgb = new HexBinaryValue("#66ffff") }) { PatternType = PatternValues.Solid }), //Blue new Fill(new PatternFill(new ForegroundColor { Rgb = new HexBinaryValue("#33cc33") }) { PatternType = PatternValues.Solid }), //Dark Green new Fill(new PatternFill(new ForegroundColor { Rgb = new HexBinaryValue("#66ff66") }) { PatternType = PatternValues.Solid }), //Green new Fill(new PatternFill(new ForegroundColor { Rgb = new HexBinaryValue("#ffcccc") }) { PatternType = PatternValues.Solid }), //purpur new Fill(new PatternFill(new ForegroundColor { Rgb = new HexBinaryValue("#ffff00") }) { PatternType = PatternValues.Solid }), //Yealow new Fill(new PatternFill(new ForegroundColor { Rgb = new HexBinaryValue("#ff9933") }) { PatternType = PatternValues.Solid }), //Orange new Fill(new PatternFill(new ForegroundColor { Rgb = new HexBinaryValue("#ff0000") }) { PatternType = PatternValues.Solid }) //Red ); Borders borders = new Borders( new Border( new LeftBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new RightBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new TopBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new BottomBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new DiagonalBorder()) ); Fonts font = new Fonts( new Font(), new Font() { Bold = new Bold(), FontSize = new FontSize() { Val = 18 } }, new Font() { Bold = new Bold(), FontSize = new FontSize() { Val = 13 } }, new Font() { Bold = new Bold(), FontSize = new FontSize() { Val = 10 } } ); CellFormats cellFormats = new CellFormats( new CellFormat { FillId = 0, BorderId = 0, ApplyFill = true, FontId = 0 }, new CellFormat { Alignment = new Alignment() { Horizontal = new EnumValue <HorizontalAlignmentValues>(HorizontalAlignmentValues.Center), Vertical = new EnumValue <VerticalAlignmentValues>(VerticalAlignmentValues.Center), WrapText = false }, FillId = 1, BorderId = 0, ApplyFill = true, FontId = 1 }, new CellFormat { Alignment = new Alignment() { Horizontal = new EnumValue <HorizontalAlignmentValues>(HorizontalAlignmentValues.Center), Vertical = new EnumValue <VerticalAlignmentValues>(VerticalAlignmentValues.Center), WrapText = true }, FillId = 1, BorderId = 0, ApplyFill = true, FontId = 2 }, new CellFormat { Alignment = new Alignment() { Horizontal = new EnumValue <HorizontalAlignmentValues>(HorizontalAlignmentValues.Center), Vertical = new EnumValue <VerticalAlignmentValues>(VerticalAlignmentValues.Center), WrapText = true }, FillId = 1, BorderId = 0, ApplyFill = true, FontId = 3 }, new CellFormat { Alignment = new Alignment() { Horizontal = new EnumValue <HorizontalAlignmentValues>(HorizontalAlignmentValues.Left), Vertical = new EnumValue <VerticalAlignmentValues>(VerticalAlignmentValues.Center), WrapText = true }, FillId = 2, BorderId = 0, ApplyFill = true, FontId = 3 }, new CellFormat { Alignment = new Alignment() { Horizontal = new EnumValue <HorizontalAlignmentValues>(HorizontalAlignmentValues.Left), Vertical = new EnumValue <VerticalAlignmentValues>(VerticalAlignmentValues.Center), WrapText = true }, FillId = 3, BorderId = 0, ApplyFill = true, FontId = 3 }, //Blue new CellFormat { Alignment = new Alignment() { Horizontal = new EnumValue <HorizontalAlignmentValues>(HorizontalAlignmentValues.Left), Vertical = new EnumValue <VerticalAlignmentValues>(VerticalAlignmentValues.Center), WrapText = true }, FillId = 4, BorderId = 0, ApplyFill = true, FontId = 3 }, //Dark Green new CellFormat { Alignment = new Alignment() { Horizontal = new EnumValue <HorizontalAlignmentValues>(HorizontalAlignmentValues.Left), Vertical = new EnumValue <VerticalAlignmentValues>(VerticalAlignmentValues.Center), WrapText = true }, FillId = 5, BorderId = 0, ApplyFill = true, FontId = 3 }, //Green new CellFormat { Alignment = new Alignment() { Horizontal = new EnumValue <HorizontalAlignmentValues>(HorizontalAlignmentValues.Left), Vertical = new EnumValue <VerticalAlignmentValues>(VerticalAlignmentValues.Center), WrapText = true }, FillId = 6, BorderId = 0, ApplyFill = true, FontId = 3 }, //purpur new CellFormat { Alignment = new Alignment() { Horizontal = new EnumValue <HorizontalAlignmentValues>(HorizontalAlignmentValues.Left), Vertical = new EnumValue <VerticalAlignmentValues>(VerticalAlignmentValues.Center), WrapText = true }, FillId = 7, BorderId = 0, ApplyFill = true, FontId = 3 }, //Yealow new CellFormat { Alignment = new Alignment() { Horizontal = new EnumValue <HorizontalAlignmentValues>(HorizontalAlignmentValues.Left), Vertical = new EnumValue <VerticalAlignmentValues>(VerticalAlignmentValues.Center), WrapText = true }, FillId = 8, BorderId = 0, ApplyFill = true, FontId = 3 }, //Orange new CellFormat { Alignment = new Alignment() { Horizontal = new EnumValue <HorizontalAlignmentValues>(HorizontalAlignmentValues.Left), Vertical = new EnumValue <VerticalAlignmentValues>(VerticalAlignmentValues.Center), WrapText = true }, FillId = 9, BorderId = 0, ApplyFill = true, FontId = 3 }, //Red new CellFormat { Alignment = new Alignment() { Horizontal = new EnumValue <HorizontalAlignmentValues>(HorizontalAlignmentValues.Left), Vertical = new EnumValue <VerticalAlignmentValues>(VerticalAlignmentValues.Center), WrapText = true }, FillId = 0, BorderId = 0, ApplyFill = true, FontId = 3 } //White ); styleSheet = new Stylesheet(font, fills, borders, cellFormats); return(styleSheet); }
private static Stylesheet GetStylesheet() { Stylesheet stylesheet = new Stylesheet(); Fonts fonts = new Fonts(); fonts.Append(new Font() { FontName = new FontName() { Val = "Calibri" }, FontSize = new FontSize() { Val = 11 }, FontFamilyNumbering = new FontFamilyNumbering() { Val = 2 }, }); fonts.Count = (uint)fonts.ChildElements.Count; Fills fills = new Fills(); fills.Append(new Fill() { PatternFill = new PatternFill() { PatternType = PatternValues.None } }); fills.Append(new Fill() { PatternFill = new PatternFill() { PatternType = PatternValues.Gray125 } }); fills.Count = (uint)fills.ChildElements.Count; Borders borders = new Borders(); borders.Append(new Border() { LeftBorder = new LeftBorder(), RightBorder = new RightBorder(), TopBorder = new TopBorder(), BottomBorder = new BottomBorder(), DiagonalBorder = new DiagonalBorder() }); borders.Count = (uint)borders.ChildElements.Count; CellStyleFormats cellstyleformats = new CellStyleFormats(); cellstyleformats.Append(new CellFormat() { NumberFormatId = 0, FontId = 0, FillId = 0, BorderId = 0 }); cellstyleformats.Count = (uint)cellstyleformats.ChildElements.Count; CellFormats cellformats = new CellFormats(); cellformats.Append(new CellFormat() { BorderId = 0, FillId = 0, FontId = 0, NumberFormatId = 0, FormatId = 0 }); cellformats.Append(new CellFormat() { BorderId = 0, FillId = 0, FontId = 0, NumberFormatId = 14, FormatId = 0, ApplyNumberFormat = true }); cellformats.Count = (uint)cellformats.ChildElements.Count; CellStyles cellstyles = new CellStyles(); cellstyles.Append(new CellStyle() { Name = "Normal", FormatId = 0, BuiltinId = 0 }); cellstyles.Count = (uint)cellstyles.ChildElements.Count; stylesheet.Append(fonts); stylesheet.Append(fills); stylesheet.Append(borders); stylesheet.Append(cellstyleformats); stylesheet.Append(cellformats); stylesheet.Append(cellstyles); return stylesheet; }
/// <remarks> /// An Excel SpreadSheet contains one or more Worksheets, each may or maynot contain data of interest. /// - Excel is a terrible way to collect data from a large number of different sources in a consistent and reliable way. /// - Be that as it may, Excel is favored by organizations that prefer manpower over automation when performing data processing tasks. /// - Most state agencies are typical of this kind of organization. /// - To top it off most of these agencies give little thought to gathering data in a consistent way. So we are likely to /// recieve a dump of spreadsheets with a variety of inconsistencies. /// /// As varied as these spreadsheets may be, a spreadsheet is expected to contain only a single type of related data set which is called a /// DataSourceType in this application. /// /// A DataSourceType describes how to process the worksheets in a spreadsheet. It indicates: /// - the name of the file to save extracted data. /// - a list of DataWorkSheets /// - an indicator as to how to process the spreadsheet against the list of DataWorkSheets: /// /// • MatchAllDataWorkSheets /// - There must be a one to one correspondence between each DataWorkSheet and each SpreadSheet WorkSheet in order. /// - The DataWorkSheet name must match the SpreadSheet WorkSheet name. /// /// • MatchByClosestWorkSheetLayout /// - Each SpreadSheet Worksheet will be matched against the closest DataWorkSheet/WorkSheetLayout /// /// A DataWorkSheet has /// - a Name to be used when processing the spreadsheet by MatchAllDataWorkSheets. /// - a WorkSheetLayout /// /// A WorkSheetLayout is /// - a collection of field layout versions with additional information about how to determine where to look /// for field cells on the spreadsheet. /// - a collection of data columns with addition information about how to determine where to look /// for the data column on the WorkSheet. /// /// - Each data column in the collection has associated with it a list of column titles that should /// map from the WorkSheet to the data column. /// /// - The WorkSheetLayout also includes a collection of col layout versions. Each of these is a list of cells /// that should be scraped for strings that are concatinated into a column title and the column to associate /// the title with. /// /// - For a given WorkSheet all layouts are processed /// /// There is a layout of column title cells that will be scaped for column titles. Those titles /// are then matched to a list of titles for a given data column. The assumption being that all titles to match /// are unique across all data columns for a given WorkSheetLayout /// </remarks> public MatchData MatchLayouts(Worksheet ws, SheetLayout sheetLayout, SharedStringTablePart stringTable, CellFormats formats, FileInfo file) { MatchData md = new MatchData(); MatchData colMD = null; MatchData cellMD = null; // All cells in worksheet. var tcs = ws.Descendants<Cell>(); switch (sheetLayout.wsLayout.layoutType) { case LayoutType.Both: colMD = MatchColLayouts(md, tcs, sheetLayout, stringTable, formats, file); cellMD = MatchCellLayouts(md, tcs, sheetLayout, stringTable, formats, file); md.fldCellMap = cellMD.fldCellMap; md.fldColMap = colMD.fldColMap; md.isPass = md.fldColMap != null && md.fldCellMap != null; break; case LayoutType.CellOnly: cellMD = MatchCellLayouts(md, tcs, sheetLayout, stringTable, formats, file); md.fldCellMap = cellMD.fldCellMap; md.isPass = md.fldCellMap != null; break; case LayoutType.ColumnOnly: colMD = MatchColLayouts(md, tcs, sheetLayout, stringTable, formats, file); md.fldColMap = colMD.fldColMap; md.isPass = md.fldColMap != null; break; } if (md.isPass) { if (sheetLayout.srcWorksheets == null) sheetLayout.srcWorksheets = new List<Worksheet>(); sheetLayout.srcWorksheets.Add(ws); } return md; }
//описвывает форматы ячеек protected void GenWorkbookStylesPart(WorkbookStylesPart workbookStylesPart) { Stylesheet stylesheet = new Stylesheet(); Fonts fonts1 = new Fonts(); Font font1 = new Font(); Font font2 = new Font(); FontSize fontSize2 = new FontSize() { Val = 11D }; Color color1 = new Color() { Rgb = "FF00B050" }; FontName fontName2 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 }; FontCharSet fontCharSet1 = new FontCharSet() { Val = 204 }; font2.Append(fontSize2); font2.Append(color1); font2.Append(fontName2); font2.Append(fontFamilyNumbering1); font2.Append(fontCharSet1); //fonts1.Append(font2); fonts1.Append(font1); Fills fills1 = new Fills(); Fill fill1 = new Fill(); Fill fill2 = new Fill(); Fill fill3 = new Fill(); PatternFill patternFill3 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor1 = new ForegroundColor() { Rgb = "0000FF" }; patternFill3.Append(foregroundColor1); fill3.Append(patternFill3); fills1.Append(fill1); fills1.Append(fill2); fills1.Append(fill3); Borders borders1 = new Borders(); Border border1 = new Border(); borders1.Append(border1); //Переопределяем номера формата 164U, 166U, 167U, 168U, NumberingFormats numberingFormats1 = new NumberingFormats() { Count = (UInt32Value)3U }; NumberingFormat numberingFormat1 = new NumberingFormat() { NumberFormatId = (UInt32Value)164U, FormatCode = "[$-F800]dddd\\,\\ mmmm\\ dd\\,\\ yyyy" }; NumberingFormat numberingFormat2 = new NumberingFormat() { NumberFormatId = (UInt32Value)166U, FormatCode = "#,##0.000\"р.\"" }; NumberingFormat numberingFormat3 = new NumberingFormat() { NumberFormatId = (UInt32Value)167U, FormatCode = "#,##0\"р.\"" }; //"#,##0.00\"р.\"" }; NumberingFormat numberingFormat4 = new NumberingFormat() { NumberFormatId = (UInt32Value)168U, FormatCode = "#,##0.00\"р.\"" }; numberingFormats1.Append(numberingFormat1); numberingFormats1.Append(numberingFormat2); numberingFormats1.Append(numberingFormat3); numberingFormats1.Append(numberingFormat4); CellFormats cellFormats1 = new CellFormats() { Count = (UInt32Value)6U }; CellFormat cellFormat2 = new CellFormat() { NumberFormatId = (UInt32Value)0U }; // Формат № 0 по умолчанию общий CellFormat cellFormat3 = new CellFormat() { NumberFormatId = (UInt32Value)164U }; // Формат № 1 для дат FormatCode = "[$-F800]dddd\\,\\ mmmm\\ dd\\,\\ yyyy" CellFormat cellFormat4 = new CellFormat() { NumberFormatId = (UInt32Value)166U }; //формат № 2 для денег по тысяч. ###,### <-- (number/ 1000) CellFormat cellFormat5 = new CellFormat() { NumberFormatId = (UInt32Value)14U }; //формат № 3 для дат * 14.03.2015 CellFormat cellFormat6 = new CellFormat() { NumberFormatId = (UInt32Value)2U }; //формат № 4 для чисел CellFormat cellFormat7 = new CellFormat() { NumberFormatId = (UInt32Value)1U }; //более подходящий формат № 5U для чисел (5U) CellFormat cellFormat8 = new CellFormat() { NumberFormatId = (UInt32Value)165U };//формат №6U для денег по умолчанию CellFormat cellFormat9 = new CellFormat() { NumberFormatId = (UInt32Value)167U };// формат №7U для денег(переопределенный) по три разряда ### ### р. CellFormat cellFormat10 = new CellFormat() { NumberFormatId = (UInt32Value)168U };// формат №8U для денег(переопределенный) ### ###,00 р. cellFormats1.Append(cellFormat2); cellFormats1.Append(cellFormat3); cellFormats1.Append(cellFormat4); cellFormats1.Append(cellFormat5); cellFormats1.Append(cellFormat6); cellFormats1.Append(cellFormat7); cellFormats1.Append(cellFormat8); cellFormats1.Append(cellFormat9); cellFormats1.Append(cellFormat10); stylesheet.Append(numberingFormats1); stylesheet.Append(fonts1); stylesheet.Append(fills1); stylesheet.Append(borders1); stylesheet.Append(cellFormats1); workbookStylesPart.Stylesheet = stylesheet; }
private bool MatchSeparatedField(IEnumerable<Cell> tcs, Field fld, FieldCellMap fm, SharedStringTablePart stringTable, CellFormats formats) { if (fm.Title != null && fld.titles.Select(t => t.ToLower()).Contains(fm.Title)) { fm.field = fld; if (fld.DataFormat == DataFormatType.Date || fld.DataFormat == DataFormatType.DateTime || fld.DataFormat == DataFormatType.DateMixed) { var cell = tcs.Where(c => c.CellReference == fm.cellLoc.ValueRef).FirstOrDefault(); fm.Value = Spreadsheet.GetCellValue(cell, stringTable.SharedStringTable, formats, fld); } return true; } return false; }
public CustomStylesheet() { var fonts = new Fonts(); var font = new DocumentFormat.OpenXml.Spreadsheet.Font(); var fontName = new FontName { Val = StringValue.FromString("Arial") }; var fontSize = new FontSize { Val = DoubleValue.FromDouble(11) }; font.FontName = fontName; font.FontSize = fontSize; fonts.Append(font); //Font Index 1 font = new DocumentFormat.OpenXml.Spreadsheet.Font(); fontName = new FontName { Val = StringValue.FromString("Arial") }; fontSize = new FontSize { Val = DoubleValue.FromDouble(12) }; font.FontName = fontName; font.FontSize = fontSize; font.Bold = new Bold(); fonts.Append(font); fonts.Count = UInt32Value.FromUInt32((uint)fonts.ChildElements.Count); var fills = new Fills(); var fill = new Fill(); var patternFill = new PatternFill { PatternType = PatternValues.None }; fill.PatternFill = patternFill; fills.Append(fill); fill = new Fill(); patternFill = new PatternFill { PatternType = PatternValues.Gray125 }; fill.PatternFill = patternFill; fills.Append(fill); //Fill index 2 fill = new Fill(); patternFill = new PatternFill { PatternType = PatternValues.Solid, ForegroundColor = new ForegroundColor() }; patternFill.ForegroundColor = TranslateForeground(System.Drawing.Color.LightBlue); patternFill.BackgroundColor = new BackgroundColor { Rgb = patternFill.ForegroundColor.Rgb }; fill.PatternFill = patternFill; fills.Append(fill); //Fill index 3 fill = new Fill(); patternFill = new PatternFill { PatternType = PatternValues.Solid, ForegroundColor = new ForegroundColor() }; patternFill.ForegroundColor = TranslateForeground(System.Drawing.Color.DodgerBlue); patternFill.BackgroundColor = new BackgroundColor { Rgb = patternFill.ForegroundColor.Rgb }; fill.PatternFill = patternFill; fills.Append(fill); fills.Count = UInt32Value.FromUInt32((uint)fills.ChildElements.Count); var borders = new Borders(); var border = new Border { LeftBorder = new LeftBorder(), RightBorder = new RightBorder(), TopBorder = new TopBorder(), BottomBorder = new BottomBorder(), DiagonalBorder = new DiagonalBorder() }; borders.Append(border); //All Boarder Index 1 border = 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() }; borders.Append(border); //Top and Bottom Boarder Index 2 border = new Border { LeftBorder = new LeftBorder(), RightBorder = new RightBorder(), TopBorder = new TopBorder { Style = BorderStyleValues.Thin }, BottomBorder = new BottomBorder { Style = BorderStyleValues.Thin }, DiagonalBorder = new DiagonalBorder() }; borders.Append(border); borders.Count = UInt32Value.FromUInt32((uint)borders.ChildElements.Count); var cellStyleFormats = new CellStyleFormats(); var cellFormat = new CellFormat { NumberFormatId = 0, FontId = 0, FillId = 0, BorderId = 0 }; cellStyleFormats.Append(cellFormat); cellStyleFormats.Count = UInt32Value.FromUInt32((uint)cellStyleFormats.ChildElements.Count); uint iExcelIndex = 164; var numberingFormats = new NumberingFormats(); var cellFormats = new CellFormats(); cellFormat = new CellFormat { NumberFormatId = 0, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0 }; cellFormats.Append(cellFormat); var nformatDateTime = new NumberingFormat { NumberFormatId = UInt32Value.FromUInt32(iExcelIndex++), FormatCode = StringValue.FromString("dd/mm/yyyy hh:mm:ss") }; numberingFormats.Append(nformatDateTime); var nformat4Decimal = new NumberingFormat { NumberFormatId = UInt32Value.FromUInt32(iExcelIndex++), FormatCode = StringValue.FromString("#,##0.0000") }; numberingFormats.Append(nformat4Decimal); var nformat2Decimal = new NumberingFormat { NumberFormatId = UInt32Value.FromUInt32(iExcelIndex++), FormatCode = StringValue.FromString("#,##0.00") }; numberingFormats.Append(nformat2Decimal); var nformatForcedText = new NumberingFormat { NumberFormatId = UInt32Value.FromUInt32(iExcelIndex), FormatCode = StringValue.FromString("@") }; numberingFormats.Append(nformatForcedText); // index 1 // Cell Standard Date format cellFormat = new CellFormat { NumberFormatId = 14, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }; cellFormats.Append(cellFormat); // Index 2 // Cell Standard Number format with 2 decimal placing cellFormat = new CellFormat { NumberFormatId = 4, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }; cellFormats.Append(cellFormat); // Index 3 // Cell Date time custom format cellFormat = new CellFormat { NumberFormatId = nformatDateTime.NumberFormatId, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }; cellFormats.Append(cellFormat); // Index 4 // Cell 4 decimal custom format cellFormat = new CellFormat { NumberFormatId = nformat4Decimal.NumberFormatId, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }; cellFormats.Append(cellFormat); // Index 5 // Cell 2 decimal custom format cellFormat = new CellFormat { NumberFormatId = nformat2Decimal.NumberFormatId, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }; cellFormats.Append(cellFormat); // Index 6 // Cell forced number text custom format cellFormat = new CellFormat { NumberFormatId = nformatForcedText.NumberFormatId, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }; cellFormats.Append(cellFormat); // Index 7 // Cell text with font 12 cellFormat = new CellFormat { NumberFormatId = nformatForcedText.NumberFormatId, FontId = 1, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }; cellFormats.Append(cellFormat); // Index 8 // Cell text cellFormat = new CellFormat { NumberFormatId = nformatForcedText.NumberFormatId, FontId = 0, FillId = 0, BorderId = 1, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }; cellFormats.Append(cellFormat); // Index 9 // Coloured 2 decimal cell text cellFormat = new CellFormat { NumberFormatId = nformat2Decimal.NumberFormatId, FontId = 0, FillId = 2, BorderId = 2, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }; cellFormats.Append(cellFormat); // Index 10 // Coloured cell text cellFormat = new CellFormat { NumberFormatId = nformatForcedText.NumberFormatId, FontId = 0, FillId = 2, BorderId = 2, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }; cellFormats.Append(cellFormat); // Index 11 // Coloured cell text cellFormat = new CellFormat { NumberFormatId = nformatForcedText.NumberFormatId, FontId = 1, FillId = 3, BorderId = 2, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }; cellFormats.Append(cellFormat); numberingFormats.Count = UInt32Value.FromUInt32((uint)numberingFormats.ChildElements.Count); cellFormats.Count = UInt32Value.FromUInt32((uint)cellFormats.ChildElements.Count); this.Append(numberingFormats); this.Append(fonts); this.Append(fills); this.Append(borders); this.Append(cellStyleFormats); this.Append(cellFormats); var css = new CellStyles(); var cs = new CellStyle { Name = StringValue.FromString("Normal"), FormatId = 0, BuiltinId = 0 }; css.Append(cs); css.Count = UInt32Value.FromUInt32((uint)css.ChildElements.Count); this.Append(css); var dfs = new DifferentialFormats { Count = 0 }; this.Append(dfs); var tss = new TableStyles { Count = 0, DefaultTableStyle = StringValue.FromString("TableStyleMedium9"), DefaultPivotStyle = StringValue.FromString("PivotStyleLight16") }; this.Append(tss); }
// Generates content of workbookStylesPart1. private void GenerateWorkbookStylesPart1Content(WorkbookStylesPart workbookStylesPart1) { Stylesheet stylesheet1 = new Stylesheet(); NumberingFormats numberingFormats1 = new NumberingFormats() { Count = (UInt32Value)2U }; NumberingFormat numberingFormat1 = new NumberingFormat() { NumberFormatId = (UInt32Value)44U, FormatCode = "_ \"$\"\\ * #,##0.00_ ;_ \"$\"\\ * \\-#,##0.00_ ;_ \"$\"\\ * \"-\"??_ ;_ @_ " }; NumberingFormat numberingFormat2 = new NumberingFormat() { NumberFormatId = (UInt32Value)165U, FormatCode = "mmmm/yyyy" }; numberingFormats1.Append(numberingFormat1); numberingFormats1.Append(numberingFormat2); Fonts fonts1 = new Fonts() { Count = (UInt32Value)10U }; Font font1 = new Font(); FontSize fontSize1 = new FontSize() { Val = 10D }; FontName fontName1 = new FontName() { Val = "Arial" }; font1.Append(fontSize1); font1.Append(fontName1); Font font2 = new Font(); FontSize fontSize2 = new FontSize() { Val = 10D }; FontName fontName2 = new FontName() { Val = "Arial" }; font2.Append(fontSize2); font2.Append(fontName2); Font font3 = new Font(); Bold bold1 = new Bold(); FontSize fontSize3 = new FontSize() { Val = 10D }; FontName fontName3 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 }; font3.Append(bold1); font3.Append(fontSize3); font3.Append(fontName3); font3.Append(fontFamilyNumbering1); Font font4 = new Font(); Bold bold2 = new Bold(); FontSize fontSize4 = new FontSize() { Val = 10D }; Color color1 = new Color() { Indexed = (UInt32Value)9U }; FontName fontName4 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering2 = new FontFamilyNumbering() { Val = 2 }; font4.Append(bold2); font4.Append(fontSize4); font4.Append(color1); font4.Append(fontName4); font4.Append(fontFamilyNumbering2); Font font5 = new Font(); FontSize fontSize5 = new FontSize() { Val = 8D }; FontName fontName5 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering3 = new FontFamilyNumbering() { Val = 2 }; font5.Append(fontSize5); font5.Append(fontName5); font5.Append(fontFamilyNumbering3); Font font6 = new Font(); Bold bold3 = new Bold(); FontSize fontSize6 = new FontSize() { Val = 8D }; FontName fontName6 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering4 = new FontFamilyNumbering() { Val = 2 }; font6.Append(bold3); font6.Append(fontSize6); font6.Append(fontName6); font6.Append(fontFamilyNumbering4); Font font7 = new Font(); Bold bold4 = new Bold(); FontSize fontSize7 = new FontSize() { Val = 15D }; FontName fontName7 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering5 = new FontFamilyNumbering() { Val = 2 }; font7.Append(bold4); font7.Append(fontSize7); font7.Append(fontName7); font7.Append(fontFamilyNumbering5); Font font8 = new Font(); FontSize fontSize8 = new FontSize() { Val = 10D }; FontName fontName8 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering6 = new FontFamilyNumbering() { Val = 2 }; font8.Append(fontSize8); font8.Append(fontName8); font8.Append(fontFamilyNumbering6); Font font9 = new Font(); FontSize fontSize9 = new FontSize() { Val = 8D }; FontName fontName9 = new FontName() { Val = "Arial" }; font9.Append(fontSize9); font9.Append(fontName9); Font font10 = new Font(); Bold bold5 = new Bold(); FontSize fontSize10 = new FontSize() { Val = 10D }; Color color2 = new Color() { Indexed = (UInt32Value)12U }; FontName fontName10 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering7 = new FontFamilyNumbering() { Val = 2 }; font10.Append(bold5); font10.Append(fontSize10); font10.Append(color2); font10.Append(fontName10); font10.Append(fontFamilyNumbering7); fonts1.Append(font1); fonts1.Append(font2); fonts1.Append(font3); fonts1.Append(font4); fonts1.Append(font5); fonts1.Append(font6); fonts1.Append(font7); fonts1.Append(font8); fonts1.Append(font9); fonts1.Append(font10); Fills fills1 = new Fills() { Count = (UInt32Value)6U }; Fill fill1 = new Fill(); PatternFill patternFill1 = new PatternFill() { PatternType = PatternValues.None }; fill1.Append(patternFill1); Fill fill2 = new Fill(); PatternFill patternFill2 = new PatternFill() { PatternType = PatternValues.Gray125 }; fill2.Append(patternFill2); Fill fill3 = new Fill(); PatternFill patternFill3 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor1 = new ForegroundColor() { Indexed = (UInt32Value)23U }; BackgroundColor backgroundColor1 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill3.Append(foregroundColor1); patternFill3.Append(backgroundColor1); fill3.Append(patternFill3); Fill fill4 = new Fill(); PatternFill patternFill4 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor2 = new ForegroundColor() { Indexed = (UInt32Value)9U }; BackgroundColor backgroundColor2 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill4.Append(foregroundColor2); patternFill4.Append(backgroundColor2); fill4.Append(patternFill4); Fill fill5 = new Fill(); PatternFill patternFill5 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor3 = new ForegroundColor() { Indexed = (UInt32Value)10U }; BackgroundColor backgroundColor3 = new BackgroundColor() { Indexed = (UInt32Value)26U }; patternFill5.Append(foregroundColor3); patternFill5.Append(backgroundColor3); fill5.Append(patternFill5); Fill fill6 = new Fill(); PatternFill patternFill6 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor4 = new ForegroundColor() { Indexed = (UInt32Value)10U }; BackgroundColor backgroundColor4 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill6.Append(foregroundColor4); patternFill6.Append(backgroundColor4); fill6.Append(patternFill6); fills1.Append(fill1); fills1.Append(fill2); fills1.Append(fill3); fills1.Append(fill4); fills1.Append(fill5); fills1.Append(fill6); Borders borders1 = new Borders() { Count = (UInt32Value)11U }; Border border1 = new Border(); LeftBorder leftBorder1 = new LeftBorder(); RightBorder rightBorder1 = new RightBorder(); TopBorder topBorder1 = new TopBorder(); BottomBorder bottomBorder1 = new BottomBorder(); DiagonalBorder diagonalBorder1 = new DiagonalBorder(); border1.Append(leftBorder1); border1.Append(rightBorder1); border1.Append(topBorder1); border1.Append(bottomBorder1); border1.Append(diagonalBorder1); Border border2 = new Border(); LeftBorder leftBorder2 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color3 = new Color() { Indexed = (UInt32Value)64U }; leftBorder2.Append(color3); RightBorder rightBorder2 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color4 = new Color() { Indexed = (UInt32Value)64U }; rightBorder2.Append(color4); TopBorder topBorder2 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color5 = new Color() { Indexed = (UInt32Value)64U }; topBorder2.Append(color5); BottomBorder bottomBorder2 = new BottomBorder(); DiagonalBorder diagonalBorder2 = new DiagonalBorder(); border2.Append(leftBorder2); border2.Append(rightBorder2); border2.Append(topBorder2); border2.Append(bottomBorder2); border2.Append(diagonalBorder2); Border border3 = new Border(); LeftBorder leftBorder3 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color6 = new Color() { Indexed = (UInt32Value)64U }; leftBorder3.Append(color6); RightBorder rightBorder3 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color7 = new Color() { Indexed = (UInt32Value)64U }; rightBorder3.Append(color7); TopBorder topBorder3 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color8 = new Color() { Indexed = (UInt32Value)64U }; topBorder3.Append(color8); BottomBorder bottomBorder3 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color9 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder3.Append(color9); DiagonalBorder diagonalBorder3 = new DiagonalBorder(); border3.Append(leftBorder3); border3.Append(rightBorder3); border3.Append(topBorder3); border3.Append(bottomBorder3); border3.Append(diagonalBorder3); Border border4 = new Border(); LeftBorder leftBorder4 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color10 = new Color() { Indexed = (UInt32Value)64U }; leftBorder4.Append(color10); RightBorder rightBorder4 = new RightBorder(); TopBorder topBorder4 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color11 = new Color() { Indexed = (UInt32Value)64U }; topBorder4.Append(color11); BottomBorder bottomBorder4 = new BottomBorder(); DiagonalBorder diagonalBorder4 = new DiagonalBorder(); border4.Append(leftBorder4); border4.Append(rightBorder4); border4.Append(topBorder4); border4.Append(bottomBorder4); border4.Append(diagonalBorder4); Border border5 = new Border(); LeftBorder leftBorder5 = new LeftBorder(); RightBorder rightBorder5 = new RightBorder(); TopBorder topBorder5 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color12 = new Color() { Indexed = (UInt32Value)64U }; topBorder5.Append(color12); BottomBorder bottomBorder5 = new BottomBorder(); DiagonalBorder diagonalBorder5 = new DiagonalBorder(); border5.Append(leftBorder5); border5.Append(rightBorder5); border5.Append(topBorder5); border5.Append(bottomBorder5); border5.Append(diagonalBorder5); Border border6 = new Border(); LeftBorder leftBorder6 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color13 = new Color() { Indexed = (UInt32Value)64U }; leftBorder6.Append(color13); RightBorder rightBorder6 = new RightBorder(); TopBorder topBorder6 = new TopBorder(); BottomBorder bottomBorder6 = new BottomBorder(); DiagonalBorder diagonalBorder6 = new DiagonalBorder(); border6.Append(leftBorder6); border6.Append(rightBorder6); border6.Append(topBorder6); border6.Append(bottomBorder6); border6.Append(diagonalBorder6); Border border7 = new Border(); LeftBorder leftBorder7 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color14 = new Color() { Indexed = (UInt32Value)64U }; leftBorder7.Append(color14); RightBorder rightBorder7 = new RightBorder(); TopBorder topBorder7 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color15 = new Color() { Indexed = (UInt32Value)64U }; topBorder7.Append(color15); BottomBorder bottomBorder7 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color16 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder7.Append(color16); DiagonalBorder diagonalBorder7 = new DiagonalBorder(); border7.Append(leftBorder7); border7.Append(rightBorder7); border7.Append(topBorder7); border7.Append(bottomBorder7); border7.Append(diagonalBorder7); Border border8 = new Border(); LeftBorder leftBorder8 = new LeftBorder(); RightBorder rightBorder8 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color17 = new Color() { Indexed = (UInt32Value)64U }; rightBorder8.Append(color17); TopBorder topBorder8 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color18 = new Color() { Indexed = (UInt32Value)64U }; topBorder8.Append(color18); BottomBorder bottomBorder8 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color19 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder8.Append(color19); DiagonalBorder diagonalBorder8 = new DiagonalBorder(); border8.Append(leftBorder8); border8.Append(rightBorder8); border8.Append(topBorder8); border8.Append(bottomBorder8); border8.Append(diagonalBorder8); Border border9 = new Border(); LeftBorder leftBorder9 = new LeftBorder(); RightBorder rightBorder9 = new RightBorder(); TopBorder topBorder9 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color20 = new Color() { Indexed = (UInt32Value)64U }; topBorder9.Append(color20); BottomBorder bottomBorder9 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color21 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder9.Append(color21); DiagonalBorder diagonalBorder9 = new DiagonalBorder(); border9.Append(leftBorder9); border9.Append(rightBorder9); border9.Append(topBorder9); border9.Append(bottomBorder9); border9.Append(diagonalBorder9); Border border10 = new Border(); LeftBorder leftBorder10 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color22 = new Color() { Indexed = (UInt32Value)64U }; leftBorder10.Append(color22); RightBorder rightBorder10 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color23 = new Color() { Indexed = (UInt32Value)64U }; rightBorder10.Append(color23); TopBorder topBorder10 = new TopBorder(); BottomBorder bottomBorder10 = new BottomBorder(); DiagonalBorder diagonalBorder10 = new DiagonalBorder(); border10.Append(leftBorder10); border10.Append(rightBorder10); border10.Append(topBorder10); border10.Append(bottomBorder10); border10.Append(diagonalBorder10); Border border11 = new Border(); LeftBorder leftBorder11 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color24 = new Color() { Indexed = (UInt32Value)64U }; leftBorder11.Append(color24); RightBorder rightBorder11 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color25 = new Color() { Indexed = (UInt32Value)64U }; rightBorder11.Append(color25); TopBorder topBorder11 = new TopBorder(); BottomBorder bottomBorder11 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color26 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder11.Append(color26); DiagonalBorder diagonalBorder11 = new DiagonalBorder(); border11.Append(leftBorder11); border11.Append(rightBorder11); border11.Append(topBorder11); border11.Append(bottomBorder11); border11.Append(diagonalBorder11); borders1.Append(border1); borders1.Append(border2); borders1.Append(border3); borders1.Append(border4); borders1.Append(border5); borders1.Append(border6); borders1.Append(border7); borders1.Append(border8); borders1.Append(border9); borders1.Append(border10); borders1.Append(border11); CellStyleFormats cellStyleFormats1 = new CellStyleFormats() { Count = (UInt32Value)2U }; CellFormat cellFormat1 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U }; CellFormat cellFormat2 = new CellFormat() { NumberFormatId = (UInt32Value)44U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, ApplyFont = false, ApplyFill = false, ApplyBorder = false, ApplyAlignment = false, ApplyProtection = false }; cellStyleFormats1.Append(cellFormat1); cellStyleFormats1.Append(cellFormat2); CellFormats cellFormats1 = new CellFormats() { Count = (UInt32Value)64U }; CellFormat cellFormat3 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; CellFormat cellFormat4 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true }; CellFormat cellFormat5 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat6 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat7 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)4U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true }; CellFormat cellFormat8 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)4U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat9 = new CellFormat() { NumberFormatId = (UInt32Value)49U, FontId = (UInt32Value)4U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat10 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)4U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment1 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat10.Append(alignment1); CellFormat cellFormat11 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment2 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat11.Append(alignment2); CellFormat cellFormat12 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment3 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat12.Append(alignment3); CellFormat cellFormat13 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)3U, FormatId = (UInt32Value)0U, ApplyBorder = true }; CellFormat cellFormat14 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)4U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat15 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)4U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)5U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat16 = new CellFormat() { NumberFormatId = (UInt32Value)49U, FontId = (UInt32Value)4U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment4 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; cellFormat16.Append(alignment4); CellFormat cellFormat17 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)4U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment5 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat17.Append(alignment5); CellFormat cellFormat18 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)6U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat19 = new CellFormat() { NumberFormatId = (UInt32Value)49U, FontId = (UInt32Value)4U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment6 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat19.Append(alignment6); CellFormat cellFormat20 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)5U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat21 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat22 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)7U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)6U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment7 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat22.Append(alignment7); CellFormat cellFormat23 = new CellFormat() { NumberFormatId = (UInt32Value)1U, FontId = (UInt32Value)2U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)7U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment8 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; cellFormat23.Append(alignment8); CellFormat cellFormat24 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)8U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)8U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat25 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)4U, BorderId = (UInt32Value)9U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment9 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat25.Append(alignment9); CellFormat cellFormat26 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)10U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment10 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat26.Append(alignment10); CellFormat cellFormat27 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)4U, BorderId = (UInt32Value)10U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat28 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment11 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat28.Append(alignment11); CellFormat cellFormat29 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)9U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment12 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat29.Append(alignment12); CellFormat cellFormat30 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat31 = new CellFormat() { NumberFormatId = (UInt32Value)4U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment13 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat31.Append(alignment13); CellFormat cellFormat32 = new CellFormat() { NumberFormatId = (UInt32Value)4U, FontId = (UInt32Value)3U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment14 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat32.Append(alignment14); CellFormat cellFormat33 = new CellFormat() { NumberFormatId = (UInt32Value)4U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat34 = new CellFormat() { NumberFormatId = (UInt32Value)4U, FontId = (UInt32Value)2U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment15 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat34.Append(alignment15); CellFormat cellFormat35 = new CellFormat() { NumberFormatId = (UInt32Value)49U, FontId = (UInt32Value)2U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment16 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left, Vertical = VerticalAlignmentValues.Top }; cellFormat35.Append(alignment16); CellFormat cellFormat36 = new CellFormat() { NumberFormatId = (UInt32Value)49U, FontId = (UInt32Value)9U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment17 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left, Vertical = VerticalAlignmentValues.Top }; cellFormat36.Append(alignment17); CellFormat cellFormat37 = new CellFormat() { NumberFormatId = (UInt32Value)165U, FontId = (UInt32Value)2U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment18 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left, Vertical = VerticalAlignmentValues.Top }; cellFormat37.Append(alignment18); CellFormat cellFormat38 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment19 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left, Vertical = VerticalAlignmentValues.Top }; cellFormat38.Append(alignment19); CellFormat cellFormat39 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)5U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment20 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left, Vertical = VerticalAlignmentValues.Top }; cellFormat39.Append(alignment20); CellFormat cellFormat40 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment21 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left, Vertical = VerticalAlignmentValues.Top }; cellFormat40.Append(alignment21); CellFormat cellFormat41 = new CellFormat() { NumberFormatId = (UInt32Value)4U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)4U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat42 = new CellFormat() { NumberFormatId = (UInt32Value)4U, FontId = (UInt32Value)4U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat43 = new CellFormat() { NumberFormatId = (UInt32Value)4U, FontId = (UInt32Value)3U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment22 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center, WrapText = true }; cellFormat43.Append(alignment22); CellFormat cellFormat44 = new CellFormat() { NumberFormatId = (UInt32Value)4U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true }; CellFormat cellFormat45 = new CellFormat() { NumberFormatId = (UInt32Value)4U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)4U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat46 = new CellFormat() { NumberFormatId = (UInt32Value)4U, FontId = (UInt32Value)4U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat47 = new CellFormat() { NumberFormatId = (UInt32Value)4U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat48 = new CellFormat() { NumberFormatId = (UInt32Value)4U, FontId = (UInt32Value)8U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)7U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat49 = new CellFormat() { NumberFormatId = (UInt32Value)4U, FontId = (UInt32Value)3U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment23 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat49.Append(alignment23); CellFormat cellFormat50 = new CellFormat() { NumberFormatId = (UInt32Value)4U, FontId = (UInt32Value)3U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)9U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment24 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat50.Append(alignment24); CellFormat cellFormat51 = new CellFormat() { NumberFormatId = (UInt32Value)4U, FontId = (UInt32Value)2U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment25 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat51.Append(alignment25); CellFormat cellFormat52 = new CellFormat() { NumberFormatId = (UInt32Value)4U, FontId = (UInt32Value)0U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment26 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat52.Append(alignment26); CellFormat cellFormat53 = new CellFormat() { NumberFormatId = (UInt32Value)4U, FontId = (UInt32Value)0U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true }; CellFormat cellFormat54 = new CellFormat() { NumberFormatId = (UInt32Value)4U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true }; CellFormat cellFormat55 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)4U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat56 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)4U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat57 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat58 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)8U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)8U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat59 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment27 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat59.Append(alignment27); CellFormat cellFormat60 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)9U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment28 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat60.Append(alignment28); CellFormat cellFormat61 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment29 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat61.Append(alignment29); CellFormat cellFormat62 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment30 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat62.Append(alignment30); CellFormat cellFormat63 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment31 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat63.Append(alignment31); CellFormat cellFormat64 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFill = true }; CellFormat cellFormat65 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true }; CellFormat cellFormat66 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment32 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center, WrapText = true }; cellFormat66.Append(alignment32); cellFormats1.Append(cellFormat3); cellFormats1.Append(cellFormat4); cellFormats1.Append(cellFormat5); cellFormats1.Append(cellFormat6); cellFormats1.Append(cellFormat7); cellFormats1.Append(cellFormat8); cellFormats1.Append(cellFormat9); cellFormats1.Append(cellFormat10); cellFormats1.Append(cellFormat11); cellFormats1.Append(cellFormat12); cellFormats1.Append(cellFormat13); cellFormats1.Append(cellFormat14); cellFormats1.Append(cellFormat15); cellFormats1.Append(cellFormat16); cellFormats1.Append(cellFormat17); cellFormats1.Append(cellFormat18); cellFormats1.Append(cellFormat19); cellFormats1.Append(cellFormat20); cellFormats1.Append(cellFormat21); cellFormats1.Append(cellFormat22); cellFormats1.Append(cellFormat23); cellFormats1.Append(cellFormat24); cellFormats1.Append(cellFormat25); cellFormats1.Append(cellFormat26); cellFormats1.Append(cellFormat27); cellFormats1.Append(cellFormat28); cellFormats1.Append(cellFormat29); cellFormats1.Append(cellFormat30); cellFormats1.Append(cellFormat31); cellFormats1.Append(cellFormat32); cellFormats1.Append(cellFormat33); cellFormats1.Append(cellFormat34); cellFormats1.Append(cellFormat35); cellFormats1.Append(cellFormat36); cellFormats1.Append(cellFormat37); cellFormats1.Append(cellFormat38); cellFormats1.Append(cellFormat39); cellFormats1.Append(cellFormat40); cellFormats1.Append(cellFormat41); cellFormats1.Append(cellFormat42); cellFormats1.Append(cellFormat43); cellFormats1.Append(cellFormat44); cellFormats1.Append(cellFormat45); cellFormats1.Append(cellFormat46); cellFormats1.Append(cellFormat47); cellFormats1.Append(cellFormat48); cellFormats1.Append(cellFormat49); cellFormats1.Append(cellFormat50); cellFormats1.Append(cellFormat51); cellFormats1.Append(cellFormat52); cellFormats1.Append(cellFormat53); cellFormats1.Append(cellFormat54); cellFormats1.Append(cellFormat55); cellFormats1.Append(cellFormat56); cellFormats1.Append(cellFormat57); cellFormats1.Append(cellFormat58); cellFormats1.Append(cellFormat59); cellFormats1.Append(cellFormat60); cellFormats1.Append(cellFormat61); cellFormats1.Append(cellFormat62); cellFormats1.Append(cellFormat63); cellFormats1.Append(cellFormat64); cellFormats1.Append(cellFormat65); cellFormats1.Append(cellFormat66); CellStyles cellStyles1 = new CellStyles() { Count = (UInt32Value)2U }; CellStyle cellStyle1 = new CellStyle() { Name = "Moneda", FormatId = (UInt32Value)1U, BuiltinId = (UInt32Value)4U }; CellStyle cellStyle2 = new CellStyle() { Name = "Normal", FormatId = (UInt32Value)0U, BuiltinId = (UInt32Value)0U }; cellStyles1.Append(cellStyle1); cellStyles1.Append(cellStyle2); DifferentialFormats differentialFormats1 = new DifferentialFormats() { Count = (UInt32Value)0U }; TableStyles tableStyles1 = new TableStyles() { Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium9", DefaultPivotStyle = "PivotStyleLight16" }; stylesheet1.Append(numberingFormats1); stylesheet1.Append(fonts1); stylesheet1.Append(fills1); stylesheet1.Append(borders1); stylesheet1.Append(cellStyleFormats1); stylesheet1.Append(cellFormats1); stylesheet1.Append(cellStyles1); stylesheet1.Append(differentialFormats1); stylesheet1.Append(tableStyles1); workbookStylesPart1.Stylesheet = stylesheet1; }
private static Dictionary<int, CellFormat> CreateCellFormatsList(CellFormats formats) { Dictionary<int, CellFormat> sharedFormatList = new Dictionary<int, CellFormat>(); int itemIndex = 0; foreach (CellFormat cell in formats.Descendants<CellFormat>()) { sharedFormatList.Add(itemIndex++, cell); } return sharedFormatList; }
/// <summary> /// Ensure cell formats are added in the order specified by the enumeration /// </summary> private static CellFormats CreateCellFormats(NumberingFormat nfDateTime, NumberingFormat nf5Decimal, NumberingFormat nfDuration, NumberingFormat nfTotalDuration) { var cfs = new CellFormats(); // CustomCellFormats.DefaultText var cf = new CellFormat(); cf.NumberFormatId = 0; cf.FontId = 0; cf.FillId = 0; cf.BorderId = 0; cf.FormatId = 0; cf.ApplyNumberFormat = BooleanValue.FromBoolean(false); cfs.AppendChild(cf); cf = new CellFormat(); cf.NumberFormatId = 0; cf.FontId = 1; cf.FillId = 0; cf.BorderId = 0; cf.FormatId = 0; cf.ApplyNumberFormat = BooleanValue.FromBoolean(false); cfs.AppendChild(cf); // CustomCellFormats.DefaultDate cf = new CellFormat(); cf.NumberFormatId = 22; // mm-dd-yy cf.FontId = 0; cf.FillId = 0; cf.BorderId = 0; cf.FormatId = 0; cf.ApplyNumberFormat = BooleanValue.FromBoolean(true); cfs.AppendChild(cf); // CustomCellFormats.DefaultNumber2DecimalPlace //cf = new CellFormat(); //cf.NumberFormatId = 4; // #,##0.00 //cf.FontId = 0; //cf.FillId = 0; //cf.BorderId = 0; //cf.FormatId = 0; //cf.ApplyNumberFormat = BooleanValue.FromBoolean(true); //cfs.AppendChild(cf); //// CustomCellFormats.DefaultNumber5DecimalPlace //cf = new CellFormat(); //cf.NumberFormatId = nf5Decimal.NumberFormatId; //cf.FontId = 0; //cf.FillId = 0; //cf.BorderId = 0; //cf.FormatId = 0; //cf.ApplyNumberFormat = BooleanValue.FromBoolean(true); //cfs.AppendChild(cf); //// CustomCellFormats.DefaultDateTime //cf = new CellFormat(); //cf.NumberFormatId = nfDateTime.NumberFormatId; //cf.FontId = 0; //cf.FillId = 0; //cf.BorderId = 0; //cf.FormatId = 0; //cf.ApplyNumberFormat = BooleanValue.FromBoolean(true); //cfs.AppendChild(cf); //// CustomCellFormats.HeaderText //cf = new CellFormat(); //cf.NumberFormatId = 0; //cf.FontId = 1; //cf.FillId = 2; //cf.BorderId = 0; //cf.FormatId = 0; //cf.ApplyNumberFormat = BooleanValue.FromBoolean(false); //cfs.AppendChild(cf); //// CustomCellFormats.TotalsNumber //cf = new CellFormat(); //cf.NumberFormatId = 0; //cf.FontId = 0; //cf.FillId = 3; //cf.BorderId = 2; //cf.FormatId = 0; //cf.ApplyNumberFormat = BooleanValue.FromBoolean(true); //cfs.AppendChild(cf); //// CustomCellFormats.TotalsNumber2DecimalPlace ////cf = new CellFormat(); ////cf.NumberFormatId = 4; // #,##0.00 ////cf.FontId = 0; ////cf.FillId = 3; ////cf.BorderId = 2; ////cf.FormatId = 0; ////cf.ApplyNumberFormat = BooleanValue.FromBoolean(true); ////cfs.AppendChild(cf); //// CustomCellFormats.TotalsText ////cf = new CellFormat(); ////cf.NumberFormatId = 49; // @ ////cf.FontId = 0; ////cf.FillId = 3; ////cf.BorderId = 2; ////cf.FormatId = 0; ////cf.ApplyNumberFormat = BooleanValue.FromBoolean(true); ////cfs.AppendChild(cf); //// CustomCellFormats.TitleText //cf = new CellFormat(); //cf.NumberFormatId = 0; //cf.FontId = 2; //cf.FillId = 0; //cf.BorderId = 0; //cf.FormatId = 0; //cf.ApplyNumberFormat = BooleanValue.FromBoolean(false); //cf.Alignment = new Alignment //{ // Vertical = new EnumValue<VerticalAlignmentValues>(VerticalAlignmentValues.Bottom) //}; //cfs.AppendChild(cf); //// CustomCellFormats.SubtitleText //cf = new CellFormat(); //cf.NumberFormatId = 0; //cf.FontId = 3; //cf.FillId = 0; //cf.BorderId = 0; //cf.FormatId = 0; //cf.ApplyNumberFormat = BooleanValue.FromBoolean(false); //cf.Alignment = new Alignment //{ // Vertical = new EnumValue<VerticalAlignmentValues>(VerticalAlignmentValues.Top) //}; //cfs.AppendChild(cf); //// CustomCellFormats.Duration //cf = new CellFormat(); //cf.NumberFormatId = nfDuration.NumberFormatId; // [h]:mm //cf.FontId = 0; //cf.FillId = 0; //cf.BorderId = 0; //cf.FormatId = 0; //cf.ApplyNumberFormat = BooleanValue.FromBoolean(true); //cf.Alignment = new Alignment //{ // Horizontal = new EnumValue<HorizontalAlignmentValues>(HorizontalAlignmentValues.Right) //}; //cfs.AppendChild(cf); //// CustomCellFormats.TotalsNumber ////cf = new CellFormat(); ////cf.NumberFormatId = nfTotalDuration.NumberFormatId; // d:h:mm ////cf.FontId = 0; ////cf.FillId = 3; ////cf.BorderId = 2; ////cf.FormatId = 0; ////cf.ApplyNumberFormat = BooleanValue.FromBoolean(true); ////cf.Alignment = new Alignment ////{ //// Horizontal = new EnumValue<HorizontalAlignmentValues>(HorizontalAlignmentValues.Right) ////}; ////cfs.AppendChild(cf); //// CustomCellFormats.Hyperlink //cf = new CellFormat(); //cf.NumberFormatId = 0; //cf.FontId = 4; //cf.FillId = 0; //cf.BorderId = 0; //cf.FormatId = 0; //cf.ApplyNumberFormat = BooleanValue.FromBoolean(false); //cfs.AppendChild(cf); cfs.Count = UInt32Value.FromUInt32((uint)cfs.ChildElements.Count); return(cfs); }
/// <summary> /// Create an stylesheet to use in excel files /// </summary> /// <returns></returns> private static Stylesheet VocStyleSheet() { Stylesheet styleSheet = new Stylesheet(); Fonts fonts = new Fonts(); // 0 - normal fonts DocumentFormat.OpenXml.Spreadsheet.Font myFont = new DocumentFormat.OpenXml.Spreadsheet.Font() { FontSize = new FontSize() { Val = 11 }, Color = new DocumentFormat.OpenXml.Spreadsheet.Color() { Rgb = new HexBinaryValue() { Value = "000000" } }, FontName = new FontName() { Val = "Calibri" } }; fonts.Append(myFont); //1 - font bold myFont = new DocumentFormat.OpenXml.Spreadsheet.Font() { Bold = new Bold(), FontSize = new FontSize() { Val = 11 }, Color = new DocumentFormat.OpenXml.Spreadsheet.Color() { Rgb = new HexBinaryValue() { Value = "000000" } }, FontName = new FontName() { Val = "Calibri" } }; fonts.Append(myFont); //2 - font title myFont = new DocumentFormat.OpenXml.Spreadsheet.Font() { Bold = new Bold(), FontSize = new FontSize() { Val = 20 }, Color = new DocumentFormat.OpenXml.Spreadsheet.Color() { Rgb = new HexBinaryValue() { Value = "FFFFFF" } }, FontName = new FontName() { Val = "Verdana" } }; fonts.Append(myFont); //3 - font bold myFont = new DocumentFormat.OpenXml.Spreadsheet.Font() { Bold = new Bold(), FontSize = new FontSize() { Val = 16 }, Color = new DocumentFormat.OpenXml.Spreadsheet.Color() { Rgb = new HexBinaryValue() { Value = "000000" } }, FontName = new FontName() { Val = "Calibri" } }; fonts.Append(myFont); //4 - small font white myFont = new DocumentFormat.OpenXml.Spreadsheet.Font() { FontSize = new FontSize() { Val = 11 }, Color = new DocumentFormat.OpenXml.Spreadsheet.Color() { Rgb = new HexBinaryValue() { Value = "FFFFFF" } }, FontName = new FontName() { Val = "Calibri" } }; fonts.Append(myFont); Fills fills = new Fills(); //default fill Fill fill = new Fill() { PatternFill = new PatternFill() { PatternType = PatternValues.None } }; fills.Append(fill); //default fill fill = new Fill() { PatternFill = new PatternFill() { PatternType = PatternValues.Gray125 } }; fills.Append(fill); //title fill fill = new Fill() { PatternFill = new PatternFill() { ForegroundColor = new ForegroundColor() { Rgb = new HexBinaryValue() { Value = "499EB1" } }, PatternType = PatternValues.Solid } }; fills.Append(fill); Borders borders = new Borders(); //normal borders Border border = new Border() { LeftBorder = new LeftBorder(), RightBorder = new RightBorder(), TopBorder = new TopBorder(), BottomBorder = new BottomBorder(), DiagonalBorder = new DiagonalBorder() }; borders.Append(border); //borders applied border = new Border() { LeftBorder = new LeftBorder() { Color = new DocumentFormat.OpenXml.Spreadsheet.Color() { Auto = true }, Style = BorderStyleValues.Thin }, RightBorder = new RightBorder() { Color = new DocumentFormat.OpenXml.Spreadsheet.Color() { Auto = true }, Style = BorderStyleValues.Thin }, TopBorder = new TopBorder() { Color = new DocumentFormat.OpenXml.Spreadsheet.Color() { Auto = true }, Style = BorderStyleValues.Thin }, BottomBorder = new BottomBorder() { Color = new DocumentFormat.OpenXml.Spreadsheet.Color() { Auto = true }, Style = BorderStyleValues.Thin }, DiagonalBorder = new DiagonalBorder() }; borders.Append(border); CellFormats cellFormats = new CellFormats(); //0- normal CellFormat cellFormat = new CellFormat() { FontId = 0, FillId = 0, BorderId = 0, ApplyFill = true }; cellFormats.Append(cellFormat); //1 - border cellFormat = new CellFormat() { FontId = 0, FillId = 0, BorderId = 1, Alignment = new Alignment() { WrapText = true }, ApplyFill = true }; cellFormats.Append(cellFormat); //2 - border and bold cellFormat = new CellFormat() { FontId = 1, FillId = 0, BorderId = 1, Alignment = new Alignment() { WrapText = true }, ApplyFill = true }; cellFormats.Append(cellFormat); //3 -title cellFormat = new CellFormat() { FontId = 0, FillId = 2, BorderId = 0, ApplyFill = true }; cellFormats.Append(cellFormat); //4 - title cellFormat = new CellFormat() { FontId = 2, FillId = 2, BorderId = 0, Alignment = new Alignment() { Horizontal = HorizontalAlignmentValues.Left, Vertical = VerticalAlignmentValues.Center }, ApplyFill = true }; cellFormats.Append(cellFormat); //5 - title cellFormat = new CellFormat() { FontId = 2, FillId = 2, BorderId = 0, Alignment = new Alignment() { Horizontal = HorizontalAlignmentValues.CenterContinuous, Vertical = VerticalAlignmentValues.Center }, ApplyFill = true }; cellFormats.Append(cellFormat); //6 - section title cellFormat = new CellFormat() { FontId = 3, FillId = 0, BorderId = 1, ApplyFill = true }; cellFormats.Append(cellFormat); //7 - section title filter values cellFormat = new CellFormat() { FontId = 4, FillId = 2, BorderId = 0, Alignment = new Alignment() { WrapText = false, Horizontal = HorizontalAlignmentValues.Left, Vertical = VerticalAlignmentValues.Center }, ApplyFill = true }; cellFormats.Append(cellFormat); styleSheet.Append(fonts); styleSheet.Append(fills); styleSheet.Append(borders); styleSheet.Append(cellFormats); return styleSheet; }
public CellFormatManager() { ActualCellFormats = new CellFormats(); SetDefaultCellFormat(); }
/// <summary> /// /// </summary> /// <remarks></remarks> /// <seealso cref=""/> /// <param name="variables"></param> /// <param name="path"></param> /// <param name="filename"></param> /// <returns></returns> public SpreadsheetDocument CreateTemplate(List <Variable> variables, string path, string filename) { if (!Directory.Exists(Path.Combine(AppConfiguration.DataPath, path))) { Directory.CreateDirectory(Path.Combine(AppConfiguration.DataPath, path)); } SpreadsheetDocument template = SpreadsheetDocument.Open(Path.Combine(AppConfiguration.GetModuleWorkspacePath("RPM"), "Template", _fileName), true); SpreadsheetDocument dataStructureFile = SpreadsheetDocument.Create(Path.Combine(AppConfiguration.DataPath, path, filename), template.DocumentType); //dataStructureFile = SpreadsheetDocument.Open(Path.Combine(AppConfiguration.GetModuleWorkspacePath("RPM"), "Template", filename), true); foreach (OpenXmlPart part in template.GetPartsOfType <OpenXmlPart>()) { OpenXmlPart newPart = dataStructureFile.AddPart <OpenXmlPart>(part); } template.Close(); // get worksheet List <StyleIndexStruct> styleIndex = new List <StyleIndexStruct>(); CellFormats cellFormats = dataStructureFile.WorkbookPart.WorkbookStylesPart.Stylesheet.Elements <CellFormats>().First(); //number 0,00 CellFormat cellFormat = new CellFormat() { NumberFormatId = (UInt32Value)2U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true }; cellFormat.Protection = new Protection(); cellFormat.Protection.Locked = false; cellFormats.Append(cellFormat); styleIndex.Add(new StyleIndexStruct() { Name = "Decimal", Index = (uint)cellFormats.Count++, DisplayPattern = null }); //number 0 cellFormat = new CellFormat() { NumberFormatId = (UInt32Value)1U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true }; cellFormat.Protection = new Protection(); cellFormat.Protection.Locked = false; cellFormats.Append(cellFormat); styleIndex.Add(new StyleIndexStruct() { Name = "Number", Index = (uint)cellFormats.Count++, DisplayPattern = null }); //text cellFormat = new CellFormat() { NumberFormatId = (UInt32Value)49U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true }; cellFormat.Protection = new Protection(); cellFormat.Protection.Locked = false; cellFormats.Append(cellFormat); styleIndex.Add(new StyleIndexStruct() { Name = "Text", Index = (uint)cellFormats.Count++, DisplayPattern = null }); //DateTime cellFormat = new CellFormat() { NumberFormatId = (UInt32Value)22U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true }; cellFormat.Protection = new Protection(); cellFormat.Protection.Locked = false; cellFormats.Append(cellFormat); styleIndex.Add(new StyleIndexStruct() { Name = "DateTime", Index = (uint)cellFormats.Count++, DisplayPattern = DataTypeDisplayPattern.Pattern.Where(p => p.Systemtype.Equals(DataTypeCode.DateTime) && p.Name.Equals("DateTime")).FirstOrDefault() }); //Date cellFormat = new CellFormat() { NumberFormatId = (UInt32Value)14U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true }; cellFormat.Protection = new Protection(); cellFormat.Protection.Locked = false; cellFormats.Append(cellFormat); styleIndex.Add(new StyleIndexStruct() { Name = "Date", Index = (uint)cellFormats.Count++, DisplayPattern = DataTypeDisplayPattern.Pattern.Where(p => p.Systemtype.Equals(DataTypeCode.DateTime) && p.Name.Equals("Date")).FirstOrDefault() }); //Time cellFormat = new CellFormat() { NumberFormatId = (UInt32Value)21U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true }; cellFormat.Protection = new Protection(); cellFormat.Protection.Locked = false; cellFormats.Append(cellFormat); styleIndex.Add(new StyleIndexStruct() { Name = "Time", Index = (uint)cellFormats.Count++, DisplayPattern = DataTypeDisplayPattern.Pattern.Where(p => p.Systemtype.Equals(DataTypeCode.DateTime) && p.Name.Equals("Time")).FirstOrDefault() }); Worksheet worksheet = dataStructureFile.WorkbookPart.WorksheetParts.First().Worksheet; List <Row> rows = GetRows(worksheet, 1, 11); foreach (Variable var in variables) { DataContainerManager CM = new DataContainerManager(); DataAttribute dataAttribute = CM.DataAttributeRepo.Get(var.DataAttribute.Id); int indexVar = variables.ToList().IndexOf(var) + 1; string columnIndex = GetClomunIndex(indexVar); string cellRef = columnIndex + 1; Cell cell = new Cell() { CellReference = cellRef, StyleIndex = (UInt32Value)4U, DataType = CellValues.String, CellValue = new CellValue(var.Label) }; rows.ElementAt(0).AppendChild(cell); cellRef = columnIndex + 2; cell = new Cell() { CellReference = cellRef, DataType = CellValues.String, StyleIndex = getExcelStyleIndex(dataAttribute.DataType, styleIndex), CellValue = new CellValue("") }; rows.ElementAt(1).AppendChild(cell); cellRef = columnIndex + 3; cell = new Cell() { CellReference = cellRef, StyleIndex = (UInt32Value)4U, DataType = CellValues.String, CellValue = new CellValue(var.Id.ToString()) }; rows.ElementAt(2).AppendChild(cell); cellRef = columnIndex + 4; cell = new Cell() { CellReference = cellRef, StyleIndex = (UInt32Value)4U, DataType = CellValues.String, CellValue = new CellValue(dataAttribute.ShortName) }; rows.ElementAt(3).AppendChild(cell); // description from variable // if not then from attribute string description = ""; description = String.IsNullOrEmpty(var.Description) ? dataAttribute.Description : var.Description; cellRef = columnIndex + 5; cell = new Cell() { CellReference = cellRef, StyleIndex = (UInt32Value)4U, DataType = CellValues.String, CellValue = new CellValue(description) }; rows.ElementAt(4).AppendChild(cell); string classification = ""; if (dataAttribute.Classification != null) { classification = dataAttribute.Classification.Name; } cellRef = columnIndex + 6; cell = new Cell() { CellReference = cellRef, StyleIndex = (UInt32Value)4U, DataType = CellValues.String, CellValue = new CellValue(classification) }; rows.ElementAt(5).AppendChild(cell); string unit = ""; if (var.Unit != null) { unit = var.Unit.Name; } cellRef = columnIndex + 7; cell = new Cell() { CellReference = cellRef, StyleIndex = (UInt32Value)4U, DataType = CellValues.String, CellValue = new CellValue(unit) }; rows.ElementAt(6).AppendChild(cell); string dataType = ""; if (dataAttribute.DataType != null) { dataType = dataAttribute.DataType.Name; } cellRef = columnIndex + 8; cell = new Cell() { CellReference = cellRef, StyleIndex = (UInt32Value)4U, DataType = CellValues.String, CellValue = new CellValue(dataType) }; rows.ElementAt(7).AppendChild(cell); cellRef = columnIndex + 9; cell = new Cell() { CellReference = cellRef, StyleIndex = (UInt32Value)4U, DataType = CellValues.String, CellValue = new CellValue(var.IsValueOptional.ToString()) }; rows.ElementAt(8).AppendChild(cell); cellRef = columnIndex + 10; cell = new Cell() { CellReference = cellRef, StyleIndex = (UInt32Value)4U, DataType = CellValues.String, CellValue = new CellValue(dataAttribute.IsMultiValue.ToString()) }; rows.ElementAt(9).AppendChild(cell); } foreach (DefinedName name in dataStructureFile.WorkbookPart.Workbook.GetFirstChild <DefinedNames>()) { if (name.Name == "Data" || name.Name == "VariableIdentifiers") { string[] tempArr = name.InnerText.Split('$'); string temp = ""; tempArr[tempArr.Count() - 2] = GetClomunIndex(variables.Count()); foreach (string t in tempArr) { if (t == tempArr.First()) { temp = temp + t; } else { temp = temp + "$" + t; } } name.Text = temp; } } //WorkbookPart workbookPart = spreadsheetDocument.WorkbookPart; //WorksheetPart worksheetPart = workbookPart.WorksheetParts.First(); dataStructureFile.WorkbookPart.Workbook.Save(); dataStructureFile.Close(); return(dataStructureFile); }
/// <summary> /// Ensure cell formats are added in the order specified by the enumeration /// </summary> private static CellFormats CreateCellFormats(NumberingFormat nfDateTime, NumberingFormat nf5Decimal, NumberingFormat nfDuration, NumberingFormat nfTotalDuration) { var cfs = new CellFormats(); // CustomCellFormats.DefaultText cfs.AppendChild(new CellFormat { NumberFormatId = 0, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(false) }); // CustomCellFormats.DefaultDate // mm-dd-yy cfs.AppendChild(new CellFormat { NumberFormatId = 14, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }); // CustomCellFormats.DefaultNumber2DecimalPlace // #,##0.00 cfs.AppendChild(new CellFormat { NumberFormatId = 4, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }); // CustomCellFormats.DefaultNumber5DecimalPlace cfs.AppendChild(new CellFormat { NumberFormatId = nf5Decimal.NumberFormatId, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }); // CustomCellFormats.DefaultDateTime cfs.AppendChild(new CellFormat { NumberFormatId = nfDateTime.NumberFormatId, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }); // CustomCellFormats.HeaderText cfs.AppendChild(new CellFormat { NumberFormatId = 0, FontId = 1, FillId = 2, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(false) }); // CustomCellFormats.TotalsNumber cfs.AppendChild(new CellFormat { NumberFormatId = 0, FontId = 0, FillId = 3, BorderId = 2, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }); // CustomCellFormats.TotalsNumber2DecimalPlace // #,##0.00 cfs.AppendChild(new CellFormat { NumberFormatId = 4, FontId = 0, FillId = 3, BorderId = 2, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }); // CustomCellFormats.TotalsText // @ cfs.AppendChild(new CellFormat { NumberFormatId = 49, FontId = 0, FillId = 3, BorderId = 2, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }); // CustomCellFormats.TitleText cfs.AppendChild(new CellFormat { NumberFormatId = 0, FontId = 2, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(false), Alignment = new Alignment { Vertical = new EnumValue <VerticalAlignmentValues>(VerticalAlignmentValues.Bottom) } }); // CustomCellFormats.SubtitleText cfs.AppendChild(new CellFormat { NumberFormatId = 0, FontId = 3, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(false), Alignment = new Alignment { Vertical = new EnumValue <VerticalAlignmentValues>(VerticalAlignmentValues.Top) } }); // CustomCellFormats.Duration // [h]:mm cfs.AppendChild(new CellFormat { NumberFormatId = nfDuration.NumberFormatId, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true), Alignment = new Alignment { Horizontal = new EnumValue <HorizontalAlignmentValues>(HorizontalAlignmentValues.Right) } }); // CustomCellFormats.TotalsNumber // d:h:mm cfs.AppendChild(new CellFormat { NumberFormatId = nfTotalDuration.NumberFormatId, FontId = 0, FillId = 3, BorderId = 2, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true), Alignment = new Alignment { Horizontal = new EnumValue <HorizontalAlignmentValues>(HorizontalAlignmentValues.Right) } }); // CustomCellFormats.Hyperlink cfs.AppendChild(new CellFormat { NumberFormatId = 0, FontId = 4, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(false) }); cfs.Count = UInt32Value.FromUInt32((uint)cfs.ChildElements.Count); return(cfs); }
public static void AddStylesToWorkbookPart(WorkbookPart part) { var workbookStylesPart = part.AddNewPart <WorkbookStylesPart>("WorkbookStyles"); var stylesheet1 = new Stylesheet { MCAttributes = new MarkupCompatibilityAttributes { Ignorable = "x14ac" } }; stylesheet1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); stylesheet1.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"); var fonts1 = new Fonts { Count = 1U, KnownFonts = true }; var font1 = new Font(); var fontSize1 = new FontSize { Val = 11D }; var color1 = new Color { Theme = 1U }; var fontName1 = new FontName { Val = "Calibri" }; var fontFamilyNumbering1 = new FontFamilyNumbering { Val = 2 }; var fontScheme1 = new FontScheme { Val = FontSchemeValues.Minor }; font1.Append(fontSize1); font1.Append(color1); font1.Append(fontName1); font1.Append(fontFamilyNumbering1); font1.Append(fontScheme1); fonts1.Append(font1); var fills1 = new Fills { Count = 2U }; var fill1 = new Fill(); var patternFill1 = new PatternFill { PatternType = PatternValues.None }; fill1.Append(patternFill1); var fill2 = new Fill(); var patternFill2 = new PatternFill { PatternType = PatternValues.Gray125 }; fill2.Append(patternFill2); fills1.Append(fill1); fills1.Append(fill2); var borders1 = new Borders { Count = 1U }; var border1 = new Border(); var leftBorder1 = new LeftBorder(); var rightBorder1 = new RightBorder(); var topBorder1 = new TopBorder(); var bottomBorder1 = new BottomBorder(); var diagonalBorder1 = new DiagonalBorder(); border1.Append(leftBorder1); border1.Append(rightBorder1); border1.Append(topBorder1); border1.Append(bottomBorder1); border1.Append(diagonalBorder1); borders1.Append(border1); var cellStyleFormats1 = new CellStyleFormats { Count = 1U }; var cellStyleFormat = new CellFormat { NumberFormatId = 0U, FontId = 0U, FillId = 0U, BorderId = 0U }; cellStyleFormats1.Append(cellStyleFormat); var cellFormats = new CellFormats { Count = 2U }; // index 0 (default) => unlocked var cellFormat0 = new CellFormat { NumberFormatId = 0U, FontId = 0U, FillId = 0U, BorderId = 0U, FormatId = 0U, ApplyProtection = true }.AppendItem(new Protection { Locked = false }); // index 1 => locked var cellFormat1 = new CellFormat { NumberFormatId = 0U, FontId = 0U, FillId = 0U, BorderId = 0U, FormatId = 0U }; cellFormats.Append(cellFormat0); cellFormats.Append(cellFormat1); var cellStyles1 = new CellStyles { Count = 1U }; var cellStyle1 = new CellStyle { Name = "Normal", FormatId = 0U, BuiltinId = 0U }; cellStyles1.Append(cellStyle1); stylesheet1.Append(fonts1); stylesheet1.Append(fills1); stylesheet1.Append(borders1); stylesheet1.Append(cellStyleFormats1); stylesheet1.Append(cellFormats); stylesheet1.Append(cellStyles1); workbookStylesPart.Stylesheet = stylesheet1; }
private Stylesheet GenerateStylesheet() { Fonts fonts = new Fonts( new Font( // Index 0 - The default font. new FontSize { Val = 10 }, new Color { Rgb = new HexBinaryValue { Value = "000000" } }, new FontName { Val = "微软雅黑" }), new Font( // Index 1 - The bold font. new Bold(), new FontSize { Val = 10 }, new Color { Rgb = new HexBinaryValue { Value = "000000" } }, new FontName { Val = "微软雅黑" }) ); Fills fills = new Fills( new Fill( // Index 0 - The default fill. new PatternFill { PatternType = PatternValues.None }), new Fill( // Index 1 - The default fill of gray 125 (required) new PatternFill { PatternType = PatternValues.Gray125 }), new Fill( // Index 2 - The header fill. new PatternFill(new ForegroundColor { Rgb = new HexBinaryValue { Value = "FFD9E1F2" } }) { PatternType = PatternValues.Solid })); for (int i = 0; i < groupColors.Length; i++) { fills.AppendChild(new Fill( new GradientFill(CreateGradientStop(0), CreateGradientStop(1, groupColors[i])) { Degree = 180 })); fills.AppendChild(new Fill( new GradientFill(CreateGradientStop(0), CreateGradientStop(1, groupColors[i])) { Degree = 0 })); } Borders borders = new Borders( new Border( // Index 0 - The default border. new LeftBorder(), new RightBorder(), new TopBorder(), new BottomBorder(), new DiagonalBorder()), new Border( // Index 1 - Applies a Left, Right, Top, Bottom border to a cell new LeftBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new RightBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new TopBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new BottomBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new DiagonalBorder()), new Border( // Index 2 - Top Border. new LeftBorder(), new RightBorder(), new TopBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new BottomBorder(), new DiagonalBorder()) ); CellFormats cellFormats = new CellFormats( new CellFormat() { FontId = 0, FillId = 0, BorderId = 0 }, // Index 0 - The default cell style. If a cell does not have a style index applied it will use this style combination instead new CellFormat(new Alignment() { Horizontal = HorizontalAlignmentValues.Center }) { FontId = 0, FillId = 0, BorderId = 1, ApplyBorder = true, ApplyAlignment = true, }, // Index 1 - All new CellFormat(new Alignment() { Horizontal = HorizontalAlignmentValues.Center }) { FontId = 1, FillId = 2, BorderId = 1, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, }, // Index 2 - Header new CellFormat(new Alignment() { Horizontal = HorizontalAlignmentValues.Center }) { FontId = 0, FillId = 2, BorderId = 1, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, }, // Index 3 - Sub Header new CellFormat(new Alignment() { Horizontal = HorizontalAlignmentValues.Fill }) { FontId = 1, FillId = 0, BorderId = 1, ApplyFont = true, ApplyBorder = true, ApplyAlignment = true, }, // Index 4 new CellFormat() { FontId = 0, FillId = 0, BorderId = 2, ApplyBorder = true, } // Index 5 - Enum ); for (uint i = 0; i < groupColors.Length; i++) { cellFormats.AppendChild(new CellFormat(new Alignment() { Horizontal = HorizontalAlignmentValues.Center }) { FontId = 0, FillId = i * 2 + 3, BorderId = 1, ApplyBorder = true, ApplyAlignment = true, ApplyFill = true, }); cellFormats.AppendChild(new CellFormat(new Alignment() { Horizontal = HorizontalAlignmentValues.Center }) { FontId = 0, FillId = i * 2 + 4, BorderId = 1, ApplyBorder = true, ApplyAlignment = true, ApplyFill = true, }); } return(new Stylesheet(fonts, fills, borders, cellFormats)); }
// Generates content of workbookStylesPart1. private static void GenerateWorkbookStylesPartContent(WorkbookStylesPart workbookStylesPart) { Stylesheet stylesheet1 = new Stylesheet(); Fills fills1 = new Fills() { Count = (UInt32Value)3U }; Fill fill1 = new Fill(); PatternFill patternFill1 = new PatternFill() { PatternType = PatternValues.None }; fill1.Append(patternFill1); Fill fill2 = new Fill(); PatternFill patternFill2 = new PatternFill() { PatternType = PatternValues.Gray125 }; fill2.Append(patternFill2); fills1.Append(fill1); fills1.Append(fill2); Borders borders = new Borders() { Count = (UInt32Value)6U }; Border noBorder = new Border(); //id 0 borders.Append(noBorder); Border leftBorder = new Border(); //id 1 Border rightBorder = new Border(); //id 2 Border topBorder = new Border(); //id 3 Border botBorder = new Border(); //id 4 Border allBorder = new Border(); //id 5 LeftBorder leftBorder1 = new LeftBorder() { Style = BorderStyleValues.Thin }; leftBorder.Append(leftBorder1); RightBorder rightBorder1 = new RightBorder() { Style = BorderStyleValues.Thin }; rightBorder.Append(rightBorder1); TopBorder topBorder1 = new TopBorder() { Style = BorderStyleValues.Thin }; topBorder.Append(topBorder1); BottomBorder bottomBorder1 = new BottomBorder() { Style = BorderStyleValues.Thin }; botBorder.Append(bottomBorder1); LeftBorder leftBorder2 = new LeftBorder() { Style = BorderStyleValues.Thin }; RightBorder rightBorder2 = new RightBorder() { Style = BorderStyleValues.Thin }; TopBorder topBorder2 = new TopBorder() { Style = BorderStyleValues.Thin }; BottomBorder bottomBorder2 = new BottomBorder() { Style = BorderStyleValues.Thin }; allBorder.Append(leftBorder2); allBorder.Append(rightBorder2); allBorder.Append(topBorder2); allBorder.Append(bottomBorder2); borders.Append(leftBorder); borders.Append(rightBorder); borders.Append(topBorder); borders.Append(botBorder); borders.Append(allBorder); Fonts fonts = new Fonts(); Font defFont = new Font(); FontSize dFontSize = new FontSize() { Val = 11D }; FontName dFontName = new FontName() { Val = "Calibri" }; defFont.Append(dFontSize); defFont.Append(dFontName); fonts.Append(defFont); foreach (FontStyleFormat f in fontStyleFormatList) { Font font = new Font(); if (f.Bold) { Bold bold = new Bold(); font.Append(bold); } if (f.Italic) { Italic italic = new Italic(); font.Append(italic); } if (f.Underline) { Underline underline = new Underline(); font.Append(underline); } FontSize fontSize = new FontSize() { Val = f.Size }; font.Append(fontSize); FontName fontName = new FontName() { Val = f.FontName }; font.Append(fontName); fonts.Append(font); } CellStyleFormats cellStyleFormats1 = new CellStyleFormats(); CellFormat cellFormat1 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U }; cellStyleFormats1.Append(cellFormat1); CellFormats cellFormats = new CellFormats(); CellFormat dCellFormat = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; cellFormats.Append(dCellFormat); int rgbId = 1; foreach (CellStyleFormat f in cellStyleFormatList) { rgbId++; Fill fill3 = new Fill(); PatternFill patternFill3 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor1 = new ForegroundColor() { Rgb = "F" + f.RgbHtmlCode }; patternFill3.Append(foregroundColor1); fill3.Append(patternFill3); fills1.Append(fill3); int treeadsw = 0; if (f.Treead) { treeadsw = 4; } int lineStyle; switch (f.LineStyle) { default: lineStyle = 0; break; case 1: lineStyle = 1; break; case 2: lineStyle = 2; break; case 3: lineStyle = 3; break; case 4: lineStyle = 4; break; case 5: lineStyle = 5; break; } CellFormat cellFormat = new CellFormat() { NumberFormatId = (UInt32Value)(UInt32)treeadsw, FontId = (UInt32Value)(UInt32)f.FontIndex, FillId = (UInt32Value)(UInt32)rgbId, BorderId = (UInt32Value)(UInt32)lineStyle, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyBorder = true, ApplyNumberFormat = f.Treead, ApplyFill = true }; cellFormats.Append(cellFormat); VerticalAlignmentValues vav; HorizontalAlignmentValues hav; switch (f.HorizontalAlignment) { default: hav = HorizontalAlignmentValues.Distributed; break; case 1: hav = HorizontalAlignmentValues.Left; break; case 2: hav = HorizontalAlignmentValues.Right; break; case 3: hav = HorizontalAlignmentValues.Center; break; } switch (f.VerticalAlignment) { default: vav = VerticalAlignmentValues.Distributed; break; case 1: vav = VerticalAlignmentValues.Bottom; break; case 2: vav = VerticalAlignmentValues.Center; break; case 3: vav = VerticalAlignmentValues.Top; break; } Alignment alignment = new Alignment() { Horizontal = hav, Vertical = vav, WrapText = f.WrapText }; cellFormat.Append(alignment); } CellStyles cellStyles1 = new CellStyles(); CellStyle cellStyle1 = new CellStyle() { Name = "Normal", FormatId = (UInt32Value)0U, BuiltinId = (UInt32Value)0U }; cellStyles1.Append(cellStyle1); DifferentialFormats differentialFormats1 = new DifferentialFormats(); TableStyles tableStyles1 = new TableStyles() { Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleMedium9" }; stylesheet1.Append(fonts); stylesheet1.Append(fills1); stylesheet1.Append(borders); stylesheet1.Append(cellStyleFormats1); stylesheet1.Append(cellFormats); stylesheet1.Append(cellStyles1); stylesheet1.Append(differentialFormats1); stylesheet1.Append(tableStyles1); workbookStylesPart.Stylesheet = stylesheet1; }
public static Stylesheet CreateStylesheet() { var ss = new Stylesheet(); var fts = new Fonts(); var ftn = new FontName { Val = "Arial" }; var ftsz = new FontSize { Val = 11 }; var ft = new DocumentFormat.OpenXml.Spreadsheet.Font { FontName = ftn, FontSize = ftsz }; fts.Append(ft); fts.Count = (uint)fts.ChildElements.Count; var fills = new Fills(); var fill = new Fill(); var patternFill = new PatternFill { PatternType = PatternValues.None }; fill.PatternFill = patternFill; fills.Append(fill); fill = new Fill(); patternFill = new PatternFill { PatternType = PatternValues.Gray125 }; fill.PatternFill = patternFill; fills.Append(fill); fills.Count = (uint)fills.ChildElements.Count; var borders = new Borders(); var border = new Border { LeftBorder = new LeftBorder(), RightBorder = new RightBorder(), TopBorder = new TopBorder(), BottomBorder = new BottomBorder(), DiagonalBorder = new DiagonalBorder() }; borders.Append(border); borders.Count = (uint)borders.ChildElements.Count; var csfs = new CellStyleFormats(); var cf = new CellFormat { NumberFormatId = 0, FontId = 0, FillId = 0, BorderId = 0 }; csfs.Append(cf); csfs.Count = (uint)csfs.ChildElements.Count; // dd/mm/yyyy is also Excel style index 14 uint iExcelIndex = 164; var nfs = new NumberingFormats(); var cfs = new CellFormats(); cf = new CellFormat { NumberFormatId = 0, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0 }; cfs.Append(cf); var nf = new NumberingFormat { NumberFormatId = iExcelIndex, FormatCode = "dd/mm/yyyy hh:mm:ss" }; nfs.Append(nf); cf = new CellFormat { NumberFormatId = nf.NumberFormatId, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = true }; cfs.Append(cf); iExcelIndex = 165; nfs = new NumberingFormats(); cfs = new CellFormats(); cf = new CellFormat { NumberFormatId = 0, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0 }; cfs.Append(cf); nf = new NumberingFormat { NumberFormatId = iExcelIndex, FormatCode = "MMM yyyy" }; nfs.Append(nf); cf = new CellFormat { NumberFormatId = nf.NumberFormatId, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = true }; cfs.Append(cf); iExcelIndex = 170; nf = new NumberingFormat { NumberFormatId = iExcelIndex, FormatCode = "#,##0.0000" }; nfs.Append(nf); cf = new CellFormat { NumberFormatId = nf.NumberFormatId, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = true }; cfs.Append(cf); // #,##0.00 is also Excel style index 4 iExcelIndex = 171; nf = new NumberingFormat { NumberFormatId = iExcelIndex, FormatCode = "#,##0.00" }; nfs.Append(nf); cf = new CellFormat { NumberFormatId = nf.NumberFormatId, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = true }; cfs.Append(cf); // @ is also Excel style index 49 iExcelIndex = 172; nf = new NumberingFormat { NumberFormatId = iExcelIndex, FormatCode = "@" }; nfs.Append(nf); cf = new CellFormat { NumberFormatId = nf.NumberFormatId, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = true }; cfs.Append(cf); nfs.Count = (uint)nfs.ChildElements.Count; cfs.Count = (uint)cfs.ChildElements.Count; ss.Append(nfs); ss.Append(fts); ss.Append(fills); ss.Append(borders); ss.Append(csfs); ss.Append(cfs); var css = new CellStyles(); var cs = new CellStyle { Name = "Normal", FormatId = 0, BuiltinId = 0 }; css.Append(cs); css.Count = (uint)css.ChildElements.Count; ss.Append(css); var dfs = new DifferentialFormats { Count = 0 }; ss.Append(dfs); var tss = new TableStyles { Count = 0, DefaultTableStyle = "TableStyleMedium9", DefaultPivotStyle = "PivotStyleLight16" }; ss.Append(tss); return(ss); }
static private void GenerateWorkbookStylesPartContent(WorkbookStylesPart workbookStylesPart1) { Stylesheet stylesheet1 = new Stylesheet() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "x14ac" } }; stylesheet1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); stylesheet1.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"); Fonts fonts1 = new Fonts() { Count = (UInt32Value)2U, KnownFonts = true }; DocumentFormat.OpenXml.Spreadsheet.Font font1 = new DocumentFormat.OpenXml.Spreadsheet.Font(); FontSize fontSize1 = new FontSize() { Val = 11D }; DocumentFormat.OpenXml.Spreadsheet.Color color1 = new DocumentFormat.OpenXml.Spreadsheet.Color() { Theme = (UInt32Value)1U }; FontName fontName1 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 }; FontScheme fontScheme1 = new FontScheme() { Val = FontSchemeValues.Minor }; font1.Append(fontSize1); font1.Append(color1); font1.Append(fontName1); font1.Append(fontFamilyNumbering1); font1.Append(fontScheme1); DocumentFormat.OpenXml.Spreadsheet.Font font2 = new DocumentFormat.OpenXml.Spreadsheet.Font(); Bold bold1 = new Bold(); FontSize fontSize2 = new FontSize() { Val = 11D }; DocumentFormat.OpenXml.Spreadsheet.Color color2 = new DocumentFormat.OpenXml.Spreadsheet.Color() { Theme = (UInt32Value)1U }; FontName fontName2 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering2 = new FontFamilyNumbering() { Val = 2 }; FontScheme fontScheme2 = new FontScheme() { Val = FontSchemeValues.Minor }; font2.Append(bold1); font2.Append(fontSize2); font2.Append(color2); font2.Append(fontName2); font2.Append(fontFamilyNumbering2); font2.Append(fontScheme2); fonts1.Append(font1); fonts1.Append(font2); Fills fills1 = new Fills() { Count = (UInt32Value)2U }; Fill fill1 = new Fill(); PatternFill patternFill1 = new PatternFill() { PatternType = PatternValues.None }; fill1.Append(patternFill1); Fill fill2 = new Fill(); PatternFill patternFill2 = new PatternFill() { PatternType = PatternValues.Gray125 }; fill2.Append(patternFill2); fills1.Append(fill1); fills1.Append(fill2); Borders borders1 = new Borders() { Count = (UInt32Value)2U }; Border border1 = new Border(); LeftBorder leftBorder1 = new LeftBorder(); RightBorder rightBorder1 = new RightBorder(); TopBorder topBorder1 = new TopBorder(); BottomBorder bottomBorder1 = new BottomBorder(); DiagonalBorder diagonalBorder1 = new DiagonalBorder(); border1.Append(leftBorder1); border1.Append(rightBorder1); border1.Append(topBorder1); border1.Append(bottomBorder1); border1.Append(diagonalBorder1); Border border2 = new Border(); LeftBorder leftBorder2 = new LeftBorder() { Style = BorderStyleValues.Thin }; DocumentFormat.OpenXml.Spreadsheet.Color color3 = new DocumentFormat.OpenXml.Spreadsheet.Color() { Indexed = (UInt32Value)64U }; leftBorder2.Append(color3); RightBorder rightBorder2 = new RightBorder() { Style = BorderStyleValues.Thin }; DocumentFormat.OpenXml.Spreadsheet.Color color4 = new DocumentFormat.OpenXml.Spreadsheet.Color() { Indexed = (UInt32Value)64U }; rightBorder2.Append(color4); TopBorder topBorder2 = new TopBorder() { Style = BorderStyleValues.Thin }; DocumentFormat.OpenXml.Spreadsheet.Color color5 = new DocumentFormat.OpenXml.Spreadsheet.Color() { Indexed = (UInt32Value)64U }; topBorder2.Append(color5); BottomBorder bottomBorder2 = new BottomBorder() { Style = BorderStyleValues.Thin }; DocumentFormat.OpenXml.Spreadsheet.Color color6 = new DocumentFormat.OpenXml.Spreadsheet.Color() { Indexed = (UInt32Value)64U }; bottomBorder2.Append(color6); DiagonalBorder diagonalBorder2 = new DiagonalBorder(); border2.Append(leftBorder2); border2.Append(rightBorder2); border2.Append(topBorder2); border2.Append(bottomBorder2); border2.Append(diagonalBorder2); borders1.Append(border1); borders1.Append(border2); CellStyleFormats cellStyleFormats1 = new CellStyleFormats() { Count = (UInt32Value)1U }; CellFormat cellFormat1 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U }; cellStyleFormats1.Append(cellFormat1); CellFormats cellFormats1 = new CellFormats() { Count = (UInt32Value)3U }; CellFormat cellFormat2 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; CellFormat cellFormat3 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyBorder = true }; CellFormat cellFormat4 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyBorder = true }; cellFormats1.Append(cellFormat2); cellFormats1.Append(cellFormat3); cellFormats1.Append(cellFormat4); CellStyles cellStyles1 = new CellStyles() { Count = (UInt32Value)1U }; CellStyle cellStyle1 = new CellStyle() { Name = "Normal", FormatId = (UInt32Value)0U, BuiltinId = (UInt32Value)0U }; cellStyles1.Append(cellStyle1); DifferentialFormats differentialFormats1 = new DifferentialFormats() { Count = (UInt32Value)0U }; TableStyles tableStyles1 = new TableStyles() { Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleLight16" }; StylesheetExtensionList stylesheetExtensionList1 = new StylesheetExtensionList(); StylesheetExtension stylesheetExtension1 = new StylesheetExtension() { Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}" }; stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"); X14.SlicerStyles slicerStyles1 = new X14.SlicerStyles() { DefaultSlicerStyle = "SlicerStyleLight1" }; stylesheetExtension1.Append(slicerStyles1); StylesheetExtension stylesheetExtension2 = new StylesheetExtension() { Uri = "{9260A510-F301-46a8-8635-F512D64BE5F5}" }; stylesheetExtension2.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"); X15.TimelineStyles timelineStyles1 = new X15.TimelineStyles() { DefaultTimelineStyle = "TimeSlicerStyleLight1" }; stylesheetExtension2.Append(timelineStyles1); stylesheetExtensionList1.Append(stylesheetExtension1); stylesheetExtensionList1.Append(stylesheetExtension2); stylesheet1.Append(fonts1); stylesheet1.Append(fills1); stylesheet1.Append(borders1); stylesheet1.Append(cellStyleFormats1); stylesheet1.Append(cellFormats1); stylesheet1.Append(cellStyles1); stylesheet1.Append(differentialFormats1); stylesheet1.Append(tableStyles1); stylesheet1.Append(stylesheetExtensionList1); workbookStylesPart1.Stylesheet = stylesheet1; }
private static Stylesheet CreateStylesheet() { // Stylesheet declarion and namespace Stylesheet stylesheet = new Stylesheet() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "x14ac" } }; stylesheet.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); stylesheet.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"); // List of fonts Fonts fontsList = new Fonts() { Count = (UInt32Value)2U, KnownFonts = true }; // FontId=0 - Regular Excel font Font font0 = new Font(); FontSize fontSize0 = new FontSize() { Val = 11D }; Color color0 = new Color() { Theme = (UInt32Value)1U }; FontName fontName0 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering0 = new FontFamilyNumbering() { Val = 2 }; FontScheme fontScheme0 = new FontScheme() { Val = FontSchemeValues.Minor }; font0.Append(fontSize0); font0.Append(color0); font0.Append(fontName0); font0.Append(fontFamilyNumbering0); font0.Append(fontScheme0); // FontId=1 - Bold font for header Font font1 = new Font(); Bold bold = new Bold(); font1.Append(bold); fontsList.Append(font0); fontsList.Append(font1); // List of fills Fills fillList = new Fills() { Count = (UInt32Value)3U }; // FillId = 0, Normal background Fill fill0 = new Fill(); PatternFill patternFill0 = new PatternFill() { PatternType = PatternValues.None }; fill0.Append(patternFill0); // FillId = 00, Normal background Fill fill00 = new Fill(); PatternFill patternFill00 = new PatternFill() { PatternType = PatternValues.None }; fill00.Append(patternFill00); // FillId = 1, Light Blue for alternating cells Fill fill1 = new Fill(); PatternFill patternFill1 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor1 = new ForegroundColor() { Rgb = "FFDEEFF7" }; patternFill1.Append(foregroundColor1); fill1.Append(patternFill1); fillList.Append(fill0); fillList.Append(fill00); fillList.Append(fill1); // Borders style Borders bordersList = new Borders() { Count = (UInt32Value)1U }; Border border1 = new Border(); LeftBorder leftBorder1 = new LeftBorder(); RightBorder rightBorder1 = new RightBorder(); TopBorder topBorder1 = new TopBorder(); BottomBorder bottomBorder1 = new BottomBorder(); DiagonalBorder diagonalBorder1 = new DiagonalBorder(); border1.Append(leftBorder1); border1.Append(rightBorder1); border1.Append(topBorder1); border1.Append(bottomBorder1); border1.Append(diagonalBorder1); bordersList.Append(border1); // List of cell styles formats CellStyleFormats cellStyleFormatsList = new CellStyleFormats() { Count = (UInt32Value)1U }; CellFormat cellFormat = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U }; cellStyleFormatsList.Append(cellFormat); // Cells formats CellFormats cellFormatsList = new CellFormats() { Count = (UInt32Value)5U }; // StyleIndex = 0 - Regular font CellFormat cellFormat0 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; // StyleIndex = 1 - Bold font CellFormat cellFormat1 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; // StyleIndex = 2 - Date (Short Date) CellFormat cellFormat2 = new CellFormat() { NumberFormatId = (UInt32Value)14U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; // StyleIndex = 3 - Light blue background (Text and Numbers) CellFormat cellFormat3 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true }; // StyleIndex = 4 - Light blue background (Date) CellFormat cellFormat4 = new CellFormat() { NumberFormatId = (UInt32Value)14U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true }; cellFormatsList.Append(cellFormat0); cellFormatsList.Append(cellFormat1); cellFormatsList.Append(cellFormat2); cellFormatsList.Append(cellFormat3); cellFormatsList.Append(cellFormat4); // Cells styles CellStyles cellStyleList = new CellStyles() { Count = (UInt32Value)1U }; CellStyle cellStyle0 = new CellStyle() { Name = "Normal", FormatId = (UInt32Value)0U, BuiltinId = (UInt32Value)0U }; cellStyleList.Append(cellStyle0); DifferentialFormats differentialFormats0 = new DifferentialFormats() { Count = (UInt32Value)0U }; TableStyles tableStyles0 = new TableStyles() { Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleMedium9" }; StylesheetExtensionList stylesheetExtensionList = new StylesheetExtensionList(); StylesheetExtension stylesheetExtension1 = new StylesheetExtension() { Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}" }; stylesheetExtensionList.Append(stylesheetExtension1); stylesheet.Append(fontsList); stylesheet.Append(fillList); stylesheet.Append(bordersList); stylesheet.Append(cellStyleFormatsList); stylesheet.Append(cellFormatsList); stylesheet.Append(cellStyleList); stylesheet.Append(differentialFormats0); stylesheet.Append(tableStyles0); stylesheet.Append(stylesheetExtensionList); return(stylesheet); }
private uint GenerateStylesheet() { WorksheetPart worksheetPart = workbookPart.AddNewPart <WorksheetPart>(); worksheetPart.Worksheet = new Worksheet(); WorkbookStylesPart workbookStylesPart1 = workbookPart.AddNewPart <WorkbookStylesPart>(); Stylesheet stylesheet1 = new Stylesheet() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "x14ac x16r2 xr" } }; stylesheet1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); stylesheet1.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"); stylesheet1.AddNamespaceDeclaration("x16r2", "http://schemas.microsoft.com/office/spreadsheetml/2015/02/main"); stylesheet1.AddNamespaceDeclaration("xr", "http://schemas.microsoft.com/office/spreadsheetml/2014/revision"); Fonts fonts1 = new Fonts() { Count = 1U, KnownFonts = true }; Font font1 = new Font(); FontSize fontSize1 = new FontSize() { Val = 11D }; Color color1 = new Color() { Theme = 1U }; FontName fontName1 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 }; FontScheme fontScheme1 = new FontScheme() { Val = FontSchemeValues.Minor }; font1.Append(fontSize1); font1.Append(color1); font1.Append(fontName1); font1.Append(fontFamilyNumbering1); font1.Append(fontScheme1); fonts1.Append(font1); Fills fills1 = new Fills() { Count = 1U }; Fill fill1 = new Fill(); PatternFill patternFill1 = new PatternFill() { PatternType = PatternValues.None }; fill1.Append(patternFill1); fills1.Append(fill1); Borders borders1 = new Borders() { Count = 0U }; Border border1 = new Border(); LeftBorder leftBorder1 = new LeftBorder(); RightBorder rightBorder1 = new RightBorder(); TopBorder topBorder1 = new TopBorder(); BottomBorder bottomBorder1 = new BottomBorder(); DiagonalBorder diagonalBorder1 = new DiagonalBorder(); border1.Append(leftBorder1); border1.Append(rightBorder1); border1.Append(topBorder1); border1.Append(bottomBorder1); border1.Append(diagonalBorder1); borders1.Append(border1); CellStyleFormats cellStyleFormats1 = new CellStyleFormats() { Count = 1U }; CellFormat cellFormat1 = new CellFormat() { NumberFormatId = 0U }; cellStyleFormats1.Append(cellFormat1); CellFormats cellFormats1 = new CellFormats() { Count = 2U }; CellFormat cellFormat43 = new CellFormat() { NumberFormatId = 0U, FormatId = 0U }; CellFormat cellFormat44 = new CellFormat() { NumberFormatId = 14U, FormatId = 0U, ApplyNumberFormat = true }; cellFormats1.Append(cellFormat43); cellFormats1.Append(cellFormat44); stylesheet1.Append(fonts1); stylesheet1.Append(fills1); stylesheet1.Append(borders1); stylesheet1.Append(cellStyleFormats1); stylesheet1.Append(cellFormats1); workbookStylesPart1.Stylesheet = stylesheet1; return(1); }
public static Stylesheet UpdateStylesheet(Stylesheet styleSheet, out List <StyleIndexStruct> styleIndex) { //start add numberingFormats after 164 uint iExcelIndex = 164; var numberFormats = new NumberingFormats(); styleIndex = new List <StyleIndexStruct>(); if (styleSheet.CellFormats == null) { styleSheet.CellFormats = new CellFormats(); styleSheet.CellFormats.Count = 0; } CellFormats cellFormats = styleSheet.Elements <CellFormats>().First(); //number 0,00 CellFormat cellFormat = new CellFormat() { NumberFormatId = (UInt32Value)2U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true }; cellFormat.Protection = new Protection(); cellFormat.Protection.Locked = false; cellFormats.Append(cellFormat); styleIndex.Add(new StyleIndexStruct() { Name = "Decimal", Index = (uint)cellFormats.Count++, DisplayPattern = null }); //number 0 cellFormat = new CellFormat() { NumberFormatId = (UInt32Value)1U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true }; cellFormat.Protection = new Protection(); cellFormat.Protection.Locked = false; cellFormats.Append(cellFormat); //styleIndex.Add(new StyleIndexStruct() { Name = "Number", Index = (uint)(uint)cellFormats.ChildElements.Count + 1, DisplayPattern = null }); styleIndex.Add(new StyleIndexStruct() { Name = "Number", Index = (uint)cellFormats.Count++, DisplayPattern = null }); //text cellFormat = new CellFormat() { NumberFormatId = (UInt32Value)49U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true }; cellFormat.Protection = new Protection(); cellFormat.Protection.Locked = false; cellFormats.Append(cellFormat); styleIndex.Add(new StyleIndexStruct() { Name = "Text", Index = (uint)cellFormats.Count++, DisplayPattern = null }); //default Date cellFormat = new CellFormat() { NumberFormatId = (UInt32Value)14U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true }; cellFormat.Protection = new Protection(); cellFormat.Protection.Locked = false; cellFormats.Append(cellFormat); styleIndex.Add(new StyleIndexStruct() { Name = "DateTime", Index = (uint)cellFormats.Count++, DisplayPattern = null }); //add cellformats from displaypattern foreach (var pattern in DataTypeDisplayPattern.Pattern) { //Excel special cases //add numberFormats from displaypattern var newNumberFortmat = new NumberingFormat { NumberFormatId = UInt32Value.FromUInt32(iExcelIndex++), FormatCode = StringValue.FromString(pattern.ExcelPattern) }; numberFormats.Append(newNumberFortmat); //if (pattern.Name.Equals("DateTime")) uInt32Value = 22U; //if (pattern.Name.Equals("Date")) uInt32Value = 14U; //if (pattern.Name.Equals("Time")) uInt32Value = 21U; ///UInt32Value uInt32Value = 0U; cellFormat = new CellFormat() { NumberFormatId = newNumberFortmat.NumberFormatId, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyNumberFormat = true }; cellFormat.Protection = new Protection(); cellFormat.Protection.Locked = false; cellFormats.Append(cellFormat); DataTypeDisplayPattern tmp = new DataTypeDisplayPattern() { Name = pattern.Name, Systemtype = pattern.Systemtype, StringPattern = pattern.ExcelPattern, RegexPattern = pattern.RegexPattern }; styleIndex.Add(new StyleIndexStruct() { Name = pattern.Name, Index = (uint)cellFormats.Count++, DisplayPattern = tmp }); } styleSheet.NumberingFormats = numberFormats; return(styleSheet); }
private static Stylesheet CreateStylesheet() { var stylesheet = new Stylesheet(); var nullsColorValue = "FF" + Parameters.Instance.NullsColor; var fonts = new Fonts( new Font { FontName = new FontName { Val = "Calibri" }, FontSize = new FontSize { Val = 11 } }, new Font { FontName = new FontName { Val = "Calibri" }, FontSize = new FontSize { Val = 11 }, Italic = new Italic(), Color = new Color { Rgb = new HexBinaryValue() { Value = nullsColorValue } } } ); fonts.Count = (uint)fonts.ChildElements.Count; var fills = new Fills( new Fill { PatternFill = new PatternFill { PatternType = PatternValues.None } }, new Fill { PatternFill = new PatternFill { PatternType = PatternValues.Gray125 } } ); fills.Count = (uint)fills.ChildElements.Count; var borders = new Borders( new Border { LeftBorder = new LeftBorder(), RightBorder = new RightBorder(), TopBorder = new TopBorder(), BottomBorder = new BottomBorder(), DiagonalBorder = new DiagonalBorder() } ); borders.Count = (uint)borders.ChildElements.Count; var cellStyleFormats = new CellStyleFormats( new CellFormat { NumberFormatId = 0, FontId = 0, FillId = 0, BorderId = 0 } ); cellStyleFormats.Count = (uint)cellStyleFormats.ChildElements.Count; var numberingFormats = new NumberingFormats( new NumberingFormat { NumberFormatId = 164u, FormatCode = "yyyy/mm/dd hh:mm:ss.000" } ); numberingFormats.Count = (uint)numberingFormats.ChildElements.Count; var cellFormats = new CellFormats( new CellFormat { NumberFormatId = 0, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0 }, new CellFormat { NumberFormatId = 164u, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = true }, new CellFormat { NumberFormatId = 0, FontId = 1, FillId = 0, BorderId = 0, FormatId = 0 } ); cellFormats.Count = (uint)cellFormats.ChildElements.Count; stylesheet.Append(numberingFormats); stylesheet.Append(fonts); stylesheet.Append(fills); stylesheet.Append(borders); stylesheet.Append(cellStyleFormats); stylesheet.Append(cellFormats); var cellStyles = new CellStyles( new CellStyle { Name = "Normal", FormatId = 0, BuiltinId = 0 } ); cellStyles.Count = (uint)cellStyles.ChildElements.Count; stylesheet.Append(cellStyles); var differentialFormats = new DifferentialFormats { Count = 0 }; stylesheet.Append(differentialFormats); var tableStyles = new TableStyles { Count = 0, DefaultTableStyle = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleLight16" }; stylesheet.Append(tableStyles); return(stylesheet); }
private Stylesheet CreateStyleSheet() { var stylesheet = new Stylesheet(); var fontNameRobotoRegular = "Roboto Regular"; var fontSize10D = 10D; var fontColorBlue = "FF099cce"; var fontColorBlack = "FF000000"; var fontColorLightGrey = "FF404040"; var fontBold = new Bold(); #region Font 0 settings (10px, "RobotoRegular", "LightGrey") (RowsHeadersValuesEntity) var font0 = new Font(); font0.Append(new FontSize { Val = fontSize10D }); font0.Append(new FontName { Val = fontNameRobotoRegular }); font0.Append(new Color { Rgb = HexBinaryValue.FromString(fontColorLightGrey) }); #endregion #region Font 1 settings (10px, "RobotoRegular", "Blue") (RowHeaderNameTotalFor + RowHeaderNameTotal + RowHeaderNameGroupByDefault ) var font1 = new Font(); font1.Append(new FontSize { Val = fontSize10D }); font1.Append(new FontName { Val = fontNameRobotoRegular }); font1.Append(new Color { Rgb = HexBinaryValue.FromString(fontColorBlue) }); #endregion #region Font 2 settings (10px, "RobotoRegular", "Black") (Row period date) var font2 = new Font(); font2.Append(new Bold()); font2.Append(new FontSize { Val = fontSize10D }); font2.Append(new FontName { Val = fontNameRobotoRegular }); font2.Append(new Color { Rgb = HexBinaryValue.FromString(fontColorBlack) }); #endregion #region Font 3 settings (10px, "RobotoRegular", "Black", bold) (Row entity headers names + Row total HeaderValue + Row totalFor HeaderValue) var font3 = new Font(); //font3.Append(fontBold); font3.Append(new FontSize { Val = fontSize10D }); font3.Append(new FontName { Val = fontNameRobotoRegular }); font3.Append(new Color { Rgb = HexBinaryValue.FromString(fontColorBlack) }); #endregion #region Add fonts, fills, borders. // Add Fonts. var fonts = new Fonts(); fonts.Append(font0); fonts.Append(font1); fonts.Append(font2); fonts.Append(font3); // Add fills. var fill0 = new Fill(); var fill1 = new Fill(); // var fill2 = new Fill(); // var fill3 = new Fill(); // var fill4 = new Fill(); // var fills = new Fills(); fills.Append(fill0); fills.Append(fill1); fills.Append(fill2); fills.Append(fill3); fills.Append(fill4); #region (Nested headers) Fill 3 (grey) var backgroundColorLightGray = "FFf1f1f1"; //#f1f1f1 var solidlightBlue = new PatternFill { PatternType = PatternValues.Solid, ForegroundColor = new ForegroundColor { Rgb = HexBinaryValue.FromString(backgroundColorLightGray) } }; //solidlightBlue.ForegroundColor = new ForegroundColor { Rgb = HexBinaryValue.FromString("FF099cce") }; //solidlightBlue.BackgroundColor = new BackgroundColor { Indexed = 64 }; fill3.PatternFill = solidlightBlue; #endregion #region (Nested rows) Fill 4 (white) var solidWhite = new PatternFill { //PatternType = PatternValues.Solid ForegroundColor = new ForegroundColor { Rgb = HexBinaryValue.FromString("FFFFFFFF") } }; //solidWhite.ForegroundColor = new ForegroundColor { Rgb = HexBinaryValue.FromString("FFFFFFFF") }; //solidWhite.BackgroundColor = new BackgroundColor { Indexed = 64 }; fill4.PatternFill = solidWhite; #endregion //#region (Nested headers) Fill 3 (blue) ////#f1f1f1 //var solidlightBlue = new PatternFill //{ // PatternType = PatternValues.Solid, // ForegroundColor = new ForegroundColor // { // Rgb = HexBinaryValue.FromString("FF099cce") // } //}; ////solidlightBlue.ForegroundColor = new ForegroundColor { Rgb = HexBinaryValue.FromString("FF099cce") }; ////solidlightBlue.BackgroundColor = new BackgroundColor { Indexed = 64 }; //fill3.PatternFill = solidlightBlue; //#endregion // Add Borders. var border0 = new Border(); var borders = new Borders(); borders.Append(border0); #endregion var verticalAligmentTop = new EnumValue <VerticalAlignmentValues>(VerticalAlignmentValues.Top); var verticalAligmentCenter = new EnumValue <VerticalAlignmentValues>(VerticalAlignmentValues.Center); var verticalAligmentBottom = new EnumValue <VerticalAlignmentValues>(VerticalAlignmentValues.Bottom); // CellFormats. var cellformat0 = new CellFormat { FontId = 0, Alignment = new Alignment { WrapText = true, Vertical = verticalAligmentCenter }, /*FillId = 0,*/ }; // RowHeaderNameGroupByDefault + RowHeaderNameTotal + RowHeaderNameTotalFor var cellformat1 = new CellFormat { FontId = 1, Alignment = new Alignment { WrapText = true, Vertical = verticalAligmentCenter } }; // RowHeaderValueTotal + RowHeaderValueTotalFor var cellformat2 = new CellFormat { FontId = 2, Alignment = new Alignment { WrapText = true, Vertical = verticalAligmentCenter }, FillId = 3, }; // RowHeaderNamesEntity var cellformat3 = new CellFormat { FontId = 2, Alignment = new Alignment { WrapText = true, Vertical = verticalAligmentCenter } }; // RowsHeadersValuesEntity var cellformat4 = new CellFormat { FontId = 0, Alignment = new Alignment { WrapText = true, Vertical = verticalAligmentCenter } }; var cellformat5 = new CellFormat { FontId = 0, Alignment = new Alignment { WrapText = true, Vertical = verticalAligmentCenter, Horizontal = HorizontalAlignmentValues.Left, } }; // (Nested rows, columns: Estimated, Actual) var cellformat6 = new CellFormat { FontId = 3, Alignment = new Alignment { WrapText = true, Vertical = verticalAligmentCenter, Horizontal = HorizontalAlignmentValues.Left, } }; // RowTotal HeaderValue + TotalFor HeaderValue // Add CellFormats. var cellformats = new CellFormats(); cellformats.Append(cellformat0); cellformats.Append(cellformat1); cellformats.Append(cellformat2); cellformats.Append(cellformat3); cellformats.Append(cellformat4); cellformats.Append(cellformat5); cellformats.Append(cellformat6); // Add FONTS, FILLS, BORDERS & CellFormats to stylesheet. (Preserve the ORDER) stylesheet.Append(fonts); stylesheet.Append(fills); stylesheet.Append(borders); stylesheet.Append(cellformats); return(stylesheet); }
public static Stylesheet GenerateDefaultStyleSheet( NumberingFormats numberingFormats = null, Fonts fonts = null, Fills fills = null, Borders borders = null, CellFormats cellFormats = null) { uint iExcelIndex = 164; return(new Stylesheet( numberingFormats ?? new NumberingFormats( // new NumberingFormat() // Custom number format # 164: especially for date-times { NumberFormatId = UInt32Value.FromUInt32(iExcelIndex++), FormatCode = StringValue.FromString("dd/MM/yyyy hh:mm:ss") }, new NumberingFormat() // Custom number format # 165: especially for date times (with a blank time) { NumberFormatId = UInt32Value.FromUInt32(iExcelIndex++), FormatCode = StringValue.FromString("dd/MM/yyyy") } ), fonts ?? new Fonts( new Font( // Index 0 - The default font. new FontSize() { Val = 11 }, new Color() { Rgb = new HexBinaryValue() { Value = "000000" } }, new FontName() { Val = "Calibri" }), new Font( // Index 1 - A 12px bold font new Bold(), new FontSize() { Val = 12 }, new Color() { Rgb = new HexBinaryValue() { Value = "000000" } }, new FontName() { Val = "Calibri" }), new Font( // Index 2 - An Italic font. new Italic(), new FontSize() { Val = 11 }, new Color() { Rgb = new HexBinaryValue() { Value = "000000" } }, new FontName() { Val = "Calibri" }) ), fills ?? new Fills( new Fill( // Index 0 - The default fill. new PatternFill() { PatternType = PatternValues.None }), new Fill( // Index 1 - The default fill (required) new PatternFill( new ForegroundColor() { Rgb = new HexBinaryValue("B8B8B8") } ) { PatternType = PatternValues.Solid }), new Fill( // Index 2 - The blue fill. new PatternFill( new ForegroundColor() { Rgb = new HexBinaryValue("BDD7EE") } ) { PatternType = PatternValues.Solid }), new Fill( // Index 3 - Gray fill. new PatternFill( new ForegroundColor() { Rgb = new HexBinaryValue("BFBFBF") } ) { PatternType = PatternValues.Solid }) ), borders ?? new Borders( new Border( // Index 0 - The default border. new LeftBorder(), new RightBorder(), new TopBorder(), new BottomBorder(), new DiagonalBorder()), new Border( // Index 1 - Applies a Left, Right, Top, Bottom border to a cell new LeftBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new RightBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new TopBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new BottomBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new DiagonalBorder()) ), cellFormats ?? new CellFormats( new CellFormat() { FontId = 0, FillId = 0, BorderId = 0 }, // Style # 0 - The default cell style. If a cell does not have a style index applied it will use this style combination instead new CellFormat() { NumberFormatId = 164 }, // Style # 1 - DateTimes new CellFormat() { NumberFormatId = 165 }, // Style # 2 - Dates (with a blank time) new CellFormat( new Alignment() { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center } ) { FontId = 1, FillId = 2, BorderId = 0, ApplyFont = true, ApplyAlignment = true }, // Style # 3 - Header row new CellFormat() { NumberFormatId = 3 }, // Style # 4 - Number format: #,##0 new CellFormat() { NumberFormatId = 4 }, // Style # 5 - Number format: #,##0.00 new CellFormat() { FontId = 1, FillId = 0, BorderId = 0, ApplyFont = true }, // Style # 6 - Bold new CellFormat() { FontId = 2, FillId = 0, BorderId = 0, ApplyFont = true }, // Style # 7 - Italic new CellFormat() { FontId = 2, FillId = 0, BorderId = 0, ApplyFont = true }, // Style # 8 - Times Roman new CellFormat() { FontId = 0, FillId = 2, BorderId = 0, ApplyFill = true }, // Style # 9 - Yellow Fill new CellFormat( // Style # 10 - Alignment new Alignment() { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center } ) { FontId = 0, FillId = 0, BorderId = 0, ApplyAlignment = true }, new CellFormat() { FontId = 0, FillId = 0, BorderId = 1, ApplyBorder = true } // Style # 11 - Border ) )); }
private Stylesheet GenerateStylesheet() { Stylesheet styleSheet = null; Fonts fonts = new Fonts( new Font( // Index 0 - default new FontSize() { Val = 10 } ), new Font( // Index 1 - header new FontSize() { Val = 10 }, new Bold(), new Color() { Rgb = "FFFFFF" } )); Fills fills = new Fills( new Fill(new PatternFill() { PatternType = PatternValues.None }), // Index 0 - default new Fill(new PatternFill() { PatternType = PatternValues.Gray125 }), // Index 1 - default new Fill(new PatternFill(new ForegroundColor { Rgb = new HexBinaryValue() { Value = "66666666" } }) { PatternType = PatternValues.Solid }) // Index 2 - header ); Borders borders = new Borders( new Border(), // index 0 default new Border( // index 1 black border new LeftBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new RightBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new TopBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new BottomBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new DiagonalBorder()) ); CellFormats cellFormats = new CellFormats( new CellFormat(), // default new CellFormat { FontId = 0, FillId = 0, BorderId = 1, ApplyBorder = true }, // body new CellFormat { FontId = 1, FillId = 2, BorderId = 1, ApplyFill = true } // header ); styleSheet = new Stylesheet(fonts, fills, borders, cellFormats); return(styleSheet); }
// Generates content of workbookStylesPart1. protected override void GenerateWorkbookStylesPartContent(WorkbookStylesPart workbookStylesPart) { Stylesheet stylesheet1 = ExcelHelper.CreateStylesheet(workbookStylesPart); var fonts = ExcelHelper.CreateFontsCollection(stylesheet1, 3U); ExcelHelper.CreateDefaultFont(fonts); ExcelHelper.CreateCustomFont(fonts, 9D, ExcelHelper.FontColorBlack, ExcelHelper.FontNameTimesNewRoman); ExcelHelper.CreateCustomFont(fonts, 9D, ExcelHelper.FontColorBlack, ExcelHelper.FontNameTimesNewRoman, isBold: true); Fills fills = ExcelHelper.CreateFillsCollection(stylesheet1, 2U); ExcelHelper.CreateFill(fills, PatternValues.None); ExcelHelper.CreateFill(fills, PatternValues.Gray125); Borders borders = ExcelHelper.CreateBordersCollection(stylesheet1, 12U); ExcelHelper.CreateBorder(borders); ExcelHelper.CreateBorder(borders, bottom: new BorderProperties(BorderStyleValues.Thin, 64U)); ExcelHelper.CreateBorder(borders, left: new BorderProperties(BorderStyleValues.Thin, 64U), top: new BorderProperties(BorderStyleValues.Thin, 64U), bottom: new BorderProperties(BorderStyleValues.Thin, 64U)); ExcelHelper.CreateBorder(borders, top: new BorderProperties(BorderStyleValues.Thin, 64U), bottom: new BorderProperties(BorderStyleValues.Thin, 64U)); ExcelHelper.CreateBorder(borders, right: new BorderProperties(BorderStyleValues.Thin, 64U), top: new BorderProperties(BorderStyleValues.Thin, 64U), bottom: new BorderProperties(BorderStyleValues.Thin, 64U)); ExcelHelper.CreateBorder(borders, left: new BorderProperties(BorderStyleValues.Thin, 64U), top: new BorderProperties(BorderStyleValues.Thin, 64U)); ExcelHelper.CreateBorder(borders, top: new BorderProperties(BorderStyleValues.Thin, 64U)); ExcelHelper.CreateBorder(borders, right: new BorderProperties(BorderStyleValues.Thin, 64U), top: new BorderProperties(BorderStyleValues.Thin, 64U)); ExcelHelper.CreateBorder(borders, left: new BorderProperties(BorderStyleValues.Thin, 64U)); ExcelHelper.CreateBorder(borders, right: new BorderProperties(BorderStyleValues.Thin, 64U)); ExcelHelper.CreateBorder(borders, left: new BorderProperties(BorderStyleValues.Thin, 64U), bottom: new BorderProperties(BorderStyleValues.Thin, 64U)); ExcelHelper.CreateBorder(borders, right: new BorderProperties(BorderStyleValues.Thin, 64U), bottom: new BorderProperties(BorderStyleValues.Thin, 64U)); CellStyleFormats cellStyleFormats1 = new CellStyleFormats() { Count = (UInt32Value)1U }; CellFormat cellFormat1 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U }; cellStyleFormats1.Append(cellFormat1); CellFormats cellFormats1 = new CellFormats() { Count = (UInt32Value)23U }; CellFormat cellFormat2 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; CellFormat cellFormat3 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true }; CellFormat cellFormat4 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true }; CellFormat cellFormat5 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyBorder = true }; CellFormat cellFormat6 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyBorder = true }; CellFormat cellFormat7 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)3U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyBorder = true }; CellFormat cellFormat8 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)4U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyBorder = true }; CellFormat cellFormat9 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyBorder = true }; CellFormat cellFormat10 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)5U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyBorder = true }; CellFormat cellFormat11 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)6U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyBorder = true }; CellFormat cellFormat12 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)7U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyBorder = true }; CellFormat cellFormat13 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)8U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyBorder = true }; CellFormat cellFormat14 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)9U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyBorder = true }; CellFormat cellFormat15 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)10U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyBorder = true }; CellFormat cellFormat16 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)11U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyBorder = true }; CellFormat cellFormat17 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyBorder = true }; CellFormat cellFormat18 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment1 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat18.Append(alignment1); CellFormat cellFormat19 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)3U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment2 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left, Vertical = VerticalAlignmentValues.Top, WrapText = true }; cellFormat19.Append(alignment2); CellFormat cellFormat20 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment3 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left, Vertical = VerticalAlignmentValues.Top, WrapText = true }; cellFormat20.Append(alignment3); CellFormat cellFormat21 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment4 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left, Vertical = VerticalAlignmentValues.Top, WrapText = true }; cellFormat21.Append(alignment4); CellFormat cellFormat22 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)3U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment5 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left, Vertical = VerticalAlignmentValues.Top }; cellFormat22.Append(alignment5); CellFormat cellFormat23 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyAlignment = true }; Alignment alignment6 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left, Vertical = VerticalAlignmentValues.Top, WrapText = true }; cellFormat23.Append(alignment6); CellFormat cellFormat24 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyAlignment = true }; Alignment alignment7 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat24.Append(alignment7); cellFormats1.Append(cellFormat2); cellFormats1.Append(cellFormat3); cellFormats1.Append(cellFormat4); cellFormats1.Append(cellFormat5); cellFormats1.Append(cellFormat6); cellFormats1.Append(cellFormat7); cellFormats1.Append(cellFormat8); cellFormats1.Append(cellFormat9); cellFormats1.Append(cellFormat10); cellFormats1.Append(cellFormat11); cellFormats1.Append(cellFormat12); cellFormats1.Append(cellFormat13); cellFormats1.Append(cellFormat14); cellFormats1.Append(cellFormat15); cellFormats1.Append(cellFormat16); cellFormats1.Append(cellFormat17); cellFormats1.Append(cellFormat18); cellFormats1.Append(cellFormat19); cellFormats1.Append(cellFormat20); cellFormats1.Append(cellFormat21); cellFormats1.Append(cellFormat22); cellFormats1.Append(cellFormat23); cellFormats1.Append(cellFormat24); CellStyles cellStyles1 = new CellStyles() { Count = (UInt32Value)1U }; CellStyle cellStyle1 = new CellStyle() { Name = "Обычный", FormatId = (UInt32Value)0U, BuiltinId = (UInt32Value)0U }; cellStyles1.Append(cellStyle1); DifferentialFormats differentialFormats1 = new DifferentialFormats() { Count = (UInt32Value)0U }; TableStyles tableStyles1 = new TableStyles() { Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleLight16" }; StylesheetExtensionList stylesheetExtensionList1 = new StylesheetExtensionList(); StylesheetExtension stylesheetExtension1 = new StylesheetExtension() { Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}" }; stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"); X14.SlicerStyles slicerStyles1 = new X14.SlicerStyles() { DefaultSlicerStyle = "SlicerStyleLight1" }; stylesheetExtension1.Append(slicerStyles1); stylesheetExtensionList1.Append(stylesheetExtension1); stylesheet1.Append(cellStyleFormats1); stylesheet1.Append(cellFormats1); stylesheet1.Append(cellStyles1); stylesheet1.Append(differentialFormats1); stylesheet1.Append(tableStyles1); stylesheet1.Append(stylesheetExtensionList1); }
private Stylesheet GenerateStylesheet() { Stylesheet styleSheet = null; Fonts fonts = new Fonts( new Font( // Index 0 - default new FontSize() { Val = 10 } ), new Font( // Index 1 - header new FontSize() { Val = 12 }, new Bold(), new Color() { Rgb = "FFFFFF" } ), new Font( // Index 2 - group row new FontSize() { Val = 11 } ), new Font( // Index 3 - bold-black-times new FontSize() { Val = 12 }, new Bold(), new FontName() { Val = "Times New Roman" } ), new Font( // Index 4 - bold-black-times-untedline new FontSize() { Val = 12 }, new Bold(), new FontName() { Val = "Times New Roman" }, new Underline() { Val = UnderlineValues.Single } ), new Font( // Index 5 - times new FontSize() { Val = 12 }, new FontName() { Val = "Times New Roman" } )); Fills fills = new Fills( new Fill(new PatternFill() { PatternType = PatternValues.None }), // Index 0 - default new Fill(new PatternFill() { PatternType = PatternValues.Gray125 }), // Index 1 - default new Fill(new PatternFill(new ForegroundColor { Rgb = new HexBinaryValue() { Value = "66666666" } }) { PatternType = PatternValues.Solid }), // Index 2 - header new Fill(new PatternFill(new ForegroundColor { Rgb = new HexBinaryValue() { Value = "d3d3d3" } }) { PatternType = PatternValues.Solid }) // Index 3 - row group ); Borders borders = new Borders( new Border(), // index 0 default new Border( // index 1 black border new LeftBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new RightBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new TopBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new BottomBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new DiagonalBorder()), new Border( // index 2 left only new LeftBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new DiagonalBorder()), new Border( // index 3 right only new RightBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new DiagonalBorder()), new Border( // index 4 left-right new LeftBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new RightBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new DiagonalBorder()), new Border( // index 5 left-right-bottom new LeftBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new RightBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new BottomBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new DiagonalBorder()) ); CellFormats cellFormats = new CellFormats( new CellFormat(), //index 0 default new CellFormat { FontId = 0, FillId = 0, BorderId = 1, ApplyBorder = true }, //index 1 body, defualt Left Text Align new CellFormat { FontId = 1, FillId = 2, BorderId = 1, ApplyFill = true, Alignment = new Alignment { Horizontal = HorizontalAlignmentValues.Center } }, //index 2 header new CellFormat { FontId = 0, FillId = 0, BorderId = 1, ApplyBorder = true, Alignment = new Alignment { Horizontal = HorizontalAlignmentValues.Right } }, //index 3 Right Text Align new CellFormat { FontId = 2, FillId = 3, BorderId = 1, ApplyBorder = true }, // index 4 row group, defualt Left Text Align new CellFormat { FontId = 2, FillId = 3, BorderId = 1, ApplyBorder = true, Alignment = new Alignment { Horizontal = HorizontalAlignmentValues.Right } }, //index 5 row group Right Text Align new CellFormat { FontId = 3, FillId = 0, BorderId = 1, ApplyBorder = true, Alignment = new Alignment { Horizontal = HorizontalAlignmentValues.Center } }, // index 6 bold center times new CellFormat { FontId = 5, FillId = 0, BorderId = 4, ApplyBorder = true, Alignment = new Alignment { Horizontal = HorizontalAlignmentValues.Right } }, // index 7 Right Text Align amount new CellFormat { FontId = 5, FillId = 0, BorderId = 4, ApplyBorder = true, Alignment = new Alignment { Horizontal = HorizontalAlignmentValues.Left } }, // index 8 left Text Align items new CellFormat { FontId = 4, FillId = 0, BorderId = 4, ApplyBorder = true, Alignment = new Alignment { Horizontal = HorizontalAlignmentValues.Left } }, // index 9 left Text Align withh bold-underline new CellFormat { FontId = 4, FillId = 0, BorderId = 1, ApplyBorder = true, Alignment = new Alignment { Horizontal = HorizontalAlignmentValues.Right } }, // index 10 right Text Align withh bold-underline-allborder new CellFormat { FontId = 5, FillId = 0, BorderId = 0, ApplyBorder = true, Alignment = new Alignment { Horizontal = HorizontalAlignmentValues.Left } }, // index 11 with no border new CellFormat { FontId = 5, FillId = 0, BorderId = 5, ApplyBorder = true, Alignment = new Alignment { Horizontal = HorizontalAlignmentValues.Left } }, // index 12 with U border new CellFormat { FontId = 5, FillId = 0, BorderId = 2, ApplyBorder = true, Alignment = new Alignment { Horizontal = HorizontalAlignmentValues.Left } }, // index 13 left border only new CellFormat { FontId = 5, FillId = 0, BorderId = 3, ApplyBorder = true, Alignment = new Alignment { Horizontal = HorizontalAlignmentValues.Left } } // index 14 right border only ); styleSheet = new Stylesheet(fonts, fills, borders, cellFormats); return(styleSheet); }
// Generates content of workbookStylesPart1. private void GenerateWorkbookStylesPart1Content(WorkbookStylesPart workbookStylesPart1) { Stylesheet stylesheet1 = new Stylesheet(); Fonts fonts1 = new Fonts() { Count = (UInt32Value)1U, KnownFonts = true }; Font font1 = new Font(); FontSize fontSize1 = new FontSize() { Val = 11D }; Color color1 = new Color() { Theme = (UInt32Value)1U }; FontName fontName1 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 }; FontScheme fontScheme1 = new FontScheme() { Val = FontSchemeValues.Minor }; font1.Append(fontSize1); font1.Append(color1); font1.Append(fontName1); font1.Append(fontFamilyNumbering1); font1.Append(fontScheme1); fonts1.Append(font1); Fills fills1 = new Fills() { Count = (UInt32Value)2U }; Fill fill1 = new Fill(); PatternFill patternFill1 = new PatternFill() { PatternType = PatternValues.None }; fill1.Append(patternFill1); Fill fill2 = new Fill(); PatternFill patternFill2 = new PatternFill() { PatternType = PatternValues.Gray125 }; fill2.Append(patternFill2); fills1.Append(fill1); fills1.Append(fill2); Borders borders1 = new Borders() { Count = (UInt32Value)1U }; Border border1 = new Border(); LeftBorder leftBorder1 = new LeftBorder(); RightBorder rightBorder1 = new RightBorder(); TopBorder topBorder1 = new TopBorder(); BottomBorder bottomBorder1 = new BottomBorder(); DiagonalBorder diagonalBorder1 = new DiagonalBorder(); border1.Append(leftBorder1); border1.Append(rightBorder1); border1.Append(topBorder1); border1.Append(bottomBorder1); border1.Append(diagonalBorder1); borders1.Append(border1); CellStyleFormats cellStyleFormats1 = new CellStyleFormats() { Count = (UInt32Value)1U }; CellFormat cellFormat1 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U }; cellStyleFormats1.Append(cellFormat1); CellFormats cellFormats1 = new CellFormats() { Count = (UInt32Value)4U }; CellFormat cellFormat2 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; CellFormat cellFormat3 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true }; CellFormat cellFormat4 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, PivotButton = true }; CellFormat cellFormat5 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyAlignment = true }; cellFormats1.Append(cellFormat2); cellFormats1.Append(cellFormat3); cellFormats1.Append(cellFormat4); cellFormats1.Append(cellFormat5); CellStyles cellStyles1 = new CellStyles() { Count = (UInt32Value)1U }; CellStyle cellStyle1 = new CellStyle() { Name = "Normal", FormatId = (UInt32Value)0U, BuiltinId = (UInt32Value)0U }; cellStyles1.Append(cellStyle1); DifferentialFormats differentialFormats1 = new DifferentialFormats() { Count = (UInt32Value)0U }; stylesheet1.Append(fonts1); stylesheet1.Append(fills1); stylesheet1.Append(borders1); stylesheet1.Append(cellStyleFormats1); stylesheet1.Append(cellFormats1); stylesheet1.Append(cellStyles1); stylesheet1.Append(differentialFormats1); workbookStylesPart1.Stylesheet = stylesheet1; }
public MatchData MatchColLayouts(MatchData md, IEnumerable<Cell> tcs, SheetLayout sheetLayout, SharedStringTablePart stringTable, CellFormats formats, FileInfo file) { // Find and map columns to sheet layouts var field_ord = sheetLayout.wsLayout.fields .Where(c => c.fldType == FieldType.column) .OrderBy(c => c.OutputOrder) .Select(c => c.OutputOrder) .ToList(); // Obtain column titles for all signature versions. md.fldColVersMaps = new List<FieldColumnVersionMap>(); foreach (var sig in sheetLayout.wsLayout.colLayouts.OrderByDescending(scl => scl.titleLocations.Count())) // for each column layout version scape the worksheet for column title values { var fldColMaps = new List<FieldColumnMap>(); var col_ord = sig.titleLocations.OrderBy(so => so.col).Select(so => so.col).ToList(); foreach (var colLayout in sig.titleLocations) { string title = ""; foreach (var c in colLayout.cellRefs) // A column may have a number of title cells that must be scraped and concatinated to product the title used for matching to data columns. { var cl = tcs.FirstOrDefault(cll => cll.CellReference.InnerText == c); var tlt = Spreadsheet.GetCellValue(cl, stringTable.SharedStringTable, formats, null); title += tlt; } title = System.Text.RegularExpressions.Regex.Replace(title.Replace('\n', ' '), @"\s+", " ").Trim().ToLower(); fldColMaps.Add(new FieldColumnMap { column = colLayout.col, title = title, col_order = col_ord.IndexOf(colLayout.col) }); } md.fldColVersMaps.Add(new FieldColumnVersionMap { colLayout = sig, colmaps = fldColMaps }); } // Match the titles to the DataColumns foreach (var fcvm in md.fldColVersMaps) { foreach (var cm in fcvm.colmaps) { try { // TODO: Performance improvement if config strings are pre-processed for whitespace and case. cm.field = sheetLayout.wsLayout.fields .Where(cc => cc.fldType == FieldType.column && cc.titles != null) .FirstOrDefault(cc => { var lct = cc.titles.Select(t => { var tt = System.Text.RegularExpressions.Regex.Replace(t, @"\s+", " "); return tt.ToLower(); }); var hasTitle = lct.Contains(cm.title); return hasTitle; }); // if required field and should be verified then check that first row has value if (sheetLayout.wsLayout.verifyFirstRowData && cm.field != null && cm.field.isRequired) { int col = fcvm.colLayout.colLayoutType == ColLayoutType.Row_Col ? cm.column : fcvm.colLayout.FirstRow; int row = fcvm.colLayout.colLayoutType == ColLayoutType.Row_Col ? fcvm.colLayout.FirstRow : cm.column; var valRef = Spreadsheet.GetCellRef(row, col); var clVal = tcs.FirstOrDefault(clv => clv.CellReference.InnerText == valRef); var val = Spreadsheet.GetCellValue(clVal, stringTable.SharedStringTable, formats, cm.field); if (!string.IsNullOrWhiteSpace(val)) { cm.hasValue = true; cm.firstRowVal = val; } } cm.field_order = cm.field != null ? field_ord.IndexOf(cm.field.OutputOrder) : -9999; } catch (Exception ex) { Log.New.Msg(ex); } } // match by neighbor // - Locate flds located by related field var flds_byRelated = sheetLayout.wsLayout.fields.Where(f => f.locType == LocateType.byRelated); // - Locate column map for related field parent var related_pairs = flds_byRelated.Select(fr => new { fr = fr, cm = fcvm.colmaps.FirstOrDefault(rcm => rcm.field != null && rcm.field.OutputOrder == fr.RelatedCol) }); // - Locate column map for related field var rf_cm = related_pairs.Where(rp => rp.cm != null).ToList().Select(rp => new { rp = rp, rc = fcvm.colmaps.FirstOrDefault(fcm => fcm.col_order == rp.cm.col_order + 1) }); // - Update the field for located column map rf_cm.ToList().ForEach(rfcm => { rfcm.rc.field = rfcm.rp.fr; rfcm.rc.field_order = rfcm.rc.field.OutputOrder; }); fcvm.notNullTitleCnt = fcvm.colmaps.Where(cm => !string.IsNullOrWhiteSpace(cm.title)).Count(); fcvm.noMatchCnt = fcvm.colmaps.Where(cm => cm.field == null).Count(); fcvm.ReqNoValCnt = fcvm.colmaps.Where(cm => cm.field != null && sheetLayout.wsLayout.verifyFirstRowData && cm.field.isRequired && !cm.hasValue).Count(); fcvm.disOrder = (int)fcvm.colmaps.Where(dm => dm.field != null).Select(dm => Math.Pow((dm.field_order - dm.col_order), 2)).Sum(); var dupCols = fcvm.colmaps.Where(dm => dm.field != null).GroupBy(cd => cd.field).Where(d => d.Count() > 1); fcvm.colDups = dupCols.Count(); } // Only match col layout versions with zero mismatch, favoring the version with the lowest disorder. var colLayout_v = md.fldColVersMaps.Where(sv => sv.noMatchCnt == 0 && sv.colDups == 0 && (!sheetLayout.wsLayout.verifyFirstRowData || sv.ReqNoValCnt == 0)).OrderByDescending(sv => sv.notNullTitleCnt).ThenByDescending(sv => sv.disOrder).FirstOrDefault(); md.fldColMap = colLayout_v; md.matchCnt += md.fldColMap != null ? 1 : 0; return md; }
// Generates content of workbookStylesPart1. private void GenerateWorkbookStylesPart1Content(WorkbookStylesPart workbookStylesPart1) { Stylesheet stylesheet1 = new Stylesheet(); NumberingFormats numberingFormats1 = new NumberingFormats() { Count = (UInt32Value)2U }; NumberingFormat numberingFormat1 = new NumberingFormat() { NumberFormatId = (UInt32Value)166U, FormatCode = "_(* #,##0_);_(* \\(#,##0\\);_(* \"-\"??_);_(@_)" }; NumberingFormat numberingFormat2 = new NumberingFormat() { NumberFormatId = (UInt32Value)167U, FormatCode = "_-* #,##0\\ _€_-;\\-* #,##0\\ _€_-;_-* \"-\"??\\ _€_-;_-@_-" }; numberingFormats1.Append(numberingFormat1); numberingFormats1.Append(numberingFormat2); Fonts fonts1 = new Fonts() { Count = (UInt32Value)14U }; Font font1 = new Font(); FontSize fontSize1 = new FontSize() { Val = 10D }; FontName fontName1 = new FontName() { Val = "Arial" }; font1.Append(fontSize1); font1.Append(fontName1); Font font2 = new Font(); Bold bold1 = new Bold(); FontSize fontSize2 = new FontSize() { Val = 10D }; FontName fontName2 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 }; font2.Append(bold1); font2.Append(fontSize2); font2.Append(fontName2); font2.Append(fontFamilyNumbering1); Font font3 = new Font(); Bold bold2 = new Bold(); Italic italic1 = new Italic(); FontSize fontSize3 = new FontSize() { Val = 10D }; FontName fontName3 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering2 = new FontFamilyNumbering() { Val = 2 }; font3.Append(bold2); font3.Append(italic1); font3.Append(fontSize3); font3.Append(fontName3); font3.Append(fontFamilyNumbering2); Font font4 = new Font(); Bold bold3 = new Bold(); FontSize fontSize4 = new FontSize() { Val = 10D }; Color color1 = new Color() { Indexed = (UInt32Value)9U }; FontName fontName4 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering3 = new FontFamilyNumbering() { Val = 2 }; font4.Append(bold3); font4.Append(fontSize4); font4.Append(color1); font4.Append(fontName4); font4.Append(fontFamilyNumbering3); Font font5 = new Font(); FontSize fontSize5 = new FontSize() { Val = 10D }; Color color2 = new Color() { Indexed = (UInt32Value)9U }; FontName fontName5 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering4 = new FontFamilyNumbering() { Val = 2 }; font5.Append(fontSize5); font5.Append(color2); font5.Append(fontName5); font5.Append(fontFamilyNumbering4); Font font6 = new Font(); Bold bold4 = new Bold(); FontSize fontSize6 = new FontSize() { Val = 10D }; Color color3 = new Color() { Indexed = (UInt32Value)12U }; FontName fontName6 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering5 = new FontFamilyNumbering() { Val = 2 }; font6.Append(bold4); font6.Append(fontSize6); font6.Append(color3); font6.Append(fontName6); font6.Append(fontFamilyNumbering5); Font font7 = new Font(); FontSize fontSize7 = new FontSize() { Val = 12D }; Color color4 = new Color() { Indexed = (UInt32Value)12U }; FontName fontName7 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering6 = new FontFamilyNumbering() { Val = 2 }; font7.Append(fontSize7); font7.Append(color4); font7.Append(fontName7); font7.Append(fontFamilyNumbering6); Font font8 = new Font(); Bold bold5 = new Bold(); FontSize fontSize8 = new FontSize() { Val = 9D }; FontName fontName8 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering7 = new FontFamilyNumbering() { Val = 2 }; font8.Append(bold5); font8.Append(fontSize8); font8.Append(fontName8); font8.Append(fontFamilyNumbering7); Font font9 = new Font(); Bold bold6 = new Bold(); FontSize fontSize9 = new FontSize() { Val = 8D }; Color color5 = new Color() { Indexed = (UInt32Value)9U }; FontName fontName9 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering8 = new FontFamilyNumbering() { Val = 2 }; font9.Append(bold6); font9.Append(fontSize9); font9.Append(color5); font9.Append(fontName9); font9.Append(fontFamilyNumbering8); Font font10 = new Font(); FontSize fontSize10 = new FontSize() { Val = 12D }; FontName fontName10 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering9 = new FontFamilyNumbering() { Val = 2 }; font10.Append(fontSize10); font10.Append(fontName10); font10.Append(fontFamilyNumbering9); Font font11 = new Font(); Bold bold7 = new Bold(); FontSize fontSize11 = new FontSize() { Val = 12D }; FontName fontName11 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering10 = new FontFamilyNumbering() { Val = 2 }; font11.Append(bold7); font11.Append(fontSize11); font11.Append(fontName11); font11.Append(fontFamilyNumbering10); Font font12 = new Font(); Bold bold8 = new Bold(); FontSize fontSize12 = new FontSize() { Val = 11D }; FontName fontName12 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering11 = new FontFamilyNumbering() { Val = 2 }; font12.Append(bold8); font12.Append(fontSize12); font12.Append(fontName12); font12.Append(fontFamilyNumbering11); Font font13 = new Font(); FontSize fontSize13 = new FontSize() { Val = 11D }; FontName fontName13 = new FontName() { Val = "Arial" }; FontFamilyNumbering fontFamilyNumbering12 = new FontFamilyNumbering() { Val = 2 }; font13.Append(fontSize13); font13.Append(fontName13); font13.Append(fontFamilyNumbering12); Font font14 = new Font(); Underline underline1 = new Underline(); FontSize fontSize14 = new FontSize() { Val = 12D }; Color color6 = new Color() { Indexed = (UInt32Value)12U }; FontName fontName14 = new FontName() { Val = "Arial" }; font14.Append(underline1); font14.Append(fontSize14); font14.Append(color6); font14.Append(fontName14); fonts1.Append(font1); fonts1.Append(font2); fonts1.Append(font3); fonts1.Append(font4); fonts1.Append(font5); fonts1.Append(font6); fonts1.Append(font7); fonts1.Append(font8); fonts1.Append(font9); fonts1.Append(font10); fonts1.Append(font11); fonts1.Append(font12); fonts1.Append(font13); fonts1.Append(font14); Fills fills1 = new Fills() { Count = (UInt32Value)13U }; Fill fill1 = new Fill(); PatternFill patternFill1 = new PatternFill() { PatternType = PatternValues.None }; fill1.Append(patternFill1); Fill fill2 = new Fill(); PatternFill patternFill2 = new PatternFill() { PatternType = PatternValues.Gray125 }; fill2.Append(patternFill2); Fill fill3 = new Fill(); PatternFill patternFill3 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor1 = new ForegroundColor() { Indexed = (UInt32Value)9U }; BackgroundColor backgroundColor1 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill3.Append(foregroundColor1); patternFill3.Append(backgroundColor1); fill3.Append(patternFill3); Fill fill4 = new Fill(); PatternFill patternFill4 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor2 = new ForegroundColor() { Indexed = (UInt32Value)10U }; BackgroundColor backgroundColor2 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill4.Append(foregroundColor2); patternFill4.Append(backgroundColor2); fill4.Append(patternFill4); Fill fill5 = new Fill(); PatternFill patternFill5 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor3 = new ForegroundColor() { Indexed = (UInt32Value)23U }; BackgroundColor backgroundColor3 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill5.Append(foregroundColor3); patternFill5.Append(backgroundColor3); fill5.Append(patternFill5); Fill fill6 = new Fill(); PatternFill patternFill6 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor4 = new ForegroundColor() { Indexed = (UInt32Value)43U }; BackgroundColor backgroundColor4 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill6.Append(foregroundColor4); patternFill6.Append(backgroundColor4); fill6.Append(patternFill6); Fill fill7 = new Fill(); PatternFill patternFill7 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor5 = new ForegroundColor() { Indexed = (UInt32Value)42U }; BackgroundColor backgroundColor5 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill7.Append(foregroundColor5); patternFill7.Append(backgroundColor5); fill7.Append(patternFill7); Fill fill8 = new Fill(); PatternFill patternFill8 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor6 = new ForegroundColor() { Indexed = (UInt32Value)55U }; BackgroundColor backgroundColor6 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill8.Append(foregroundColor6); patternFill8.Append(backgroundColor6); fill8.Append(patternFill8); Fill fill9 = new Fill(); PatternFill patternFill9 = new PatternFill() { PatternType = PatternValues.None }; ForegroundColor foregroundColor7 = new ForegroundColor() { Indexed = (UInt32Value)9U }; BackgroundColor backgroundColor7 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill9.Append(foregroundColor7); patternFill9.Append(backgroundColor7); fill9.Append(patternFill9); Fill fill10 = new Fill(); PatternFill patternFill10 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor8 = new ForegroundColor() { Theme = (UInt32Value)0U }; BackgroundColor backgroundColor8 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill10.Append(foregroundColor8); patternFill10.Append(backgroundColor8); fill10.Append(patternFill10); Fill fill11 = new Fill(); PatternFill patternFill11 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor9 = new ForegroundColor() { Rgb = "FFFFE699" }; BackgroundColor backgroundColor9 = new BackgroundColor() { Rgb = "FF000000" }; patternFill11.Append(foregroundColor9); patternFill11.Append(backgroundColor9); fill11.Append(patternFill11); Fill fill12 = new Fill(); PatternFill patternFill12 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor10 = new ForegroundColor() { Rgb = "FFCCFFCC" }; BackgroundColor backgroundColor10 = new BackgroundColor() { Rgb = "FF000000" }; patternFill12.Append(foregroundColor10); patternFill12.Append(backgroundColor10); fill12.Append(patternFill12); Fill fill13 = new Fill(); PatternFill patternFill13 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor11 = new ForegroundColor() { Rgb = "FF969696" }; BackgroundColor backgroundColor11 = new BackgroundColor() { Rgb = "FF000000" }; patternFill13.Append(foregroundColor11); patternFill13.Append(backgroundColor11); fill13.Append(patternFill13); fills1.Append(fill1); fills1.Append(fill2); fills1.Append(fill3); fills1.Append(fill4); fills1.Append(fill5); fills1.Append(fill6); fills1.Append(fill7); fills1.Append(fill8); fills1.Append(fill9); fills1.Append(fill10); fills1.Append(fill11); fills1.Append(fill12); fills1.Append(fill13); Borders borders1 = new Borders() { Count = (UInt32Value)27U }; Border border1 = new Border(); LeftBorder leftBorder1 = new LeftBorder(); RightBorder rightBorder1 = new RightBorder(); TopBorder topBorder1 = new TopBorder(); BottomBorder bottomBorder1 = new BottomBorder(); DiagonalBorder diagonalBorder1 = new DiagonalBorder(); border1.Append(leftBorder1); border1.Append(rightBorder1); border1.Append(topBorder1); border1.Append(bottomBorder1); border1.Append(diagonalBorder1); Border border2 = new Border(); LeftBorder leftBorder2 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color7 = new Color() { Indexed = (UInt32Value)64U }; leftBorder2.Append(color7); RightBorder rightBorder2 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color8 = new Color() { Indexed = (UInt32Value)64U }; rightBorder2.Append(color8); TopBorder topBorder2 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color9 = new Color() { Indexed = (UInt32Value)64U }; topBorder2.Append(color9); BottomBorder bottomBorder2 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color10 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder2.Append(color10); DiagonalBorder diagonalBorder2 = new DiagonalBorder(); border2.Append(leftBorder2); border2.Append(rightBorder2); border2.Append(topBorder2); border2.Append(bottomBorder2); border2.Append(diagonalBorder2); Border border3 = new Border(); LeftBorder leftBorder3 = new LeftBorder(); RightBorder rightBorder3 = new RightBorder(); TopBorder topBorder3 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color11 = new Color() { Indexed = (UInt32Value)64U }; topBorder3.Append(color11); BottomBorder bottomBorder3 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color12 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder3.Append(color12); DiagonalBorder diagonalBorder3 = new DiagonalBorder(); border3.Append(leftBorder3); border3.Append(rightBorder3); border3.Append(topBorder3); border3.Append(bottomBorder3); border3.Append(diagonalBorder3); Border border4 = new Border(); LeftBorder leftBorder4 = new LeftBorder(); RightBorder rightBorder4 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color13 = new Color() { Indexed = (UInt32Value)64U }; rightBorder4.Append(color13); TopBorder topBorder4 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color14 = new Color() { Indexed = (UInt32Value)64U }; topBorder4.Append(color14); BottomBorder bottomBorder4 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color15 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder4.Append(color15); DiagonalBorder diagonalBorder4 = new DiagonalBorder(); border4.Append(leftBorder4); border4.Append(rightBorder4); border4.Append(topBorder4); border4.Append(bottomBorder4); border4.Append(diagonalBorder4); Border border5 = new Border(); LeftBorder leftBorder5 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color16 = new Color() { Indexed = (UInt32Value)64U }; leftBorder5.Append(color16); RightBorder rightBorder5 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color17 = new Color() { Indexed = (UInt32Value)64U }; rightBorder5.Append(color17); TopBorder topBorder5 = new TopBorder(); BottomBorder bottomBorder5 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color18 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder5.Append(color18); DiagonalBorder diagonalBorder5 = new DiagonalBorder(); border5.Append(leftBorder5); border5.Append(rightBorder5); border5.Append(topBorder5); border5.Append(bottomBorder5); border5.Append(diagonalBorder5); Border border6 = new Border(); LeftBorder leftBorder6 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color19 = new Color() { Indexed = (UInt32Value)64U }; leftBorder6.Append(color19); RightBorder rightBorder6 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color20 = new Color() { Indexed = (UInt32Value)64U }; rightBorder6.Append(color20); TopBorder topBorder6 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color21 = new Color() { Indexed = (UInt32Value)64U }; topBorder6.Append(color21); BottomBorder bottomBorder6 = new BottomBorder(); DiagonalBorder diagonalBorder6 = new DiagonalBorder(); border6.Append(leftBorder6); border6.Append(rightBorder6); border6.Append(topBorder6); border6.Append(bottomBorder6); border6.Append(diagonalBorder6); Border border7 = new Border(); LeftBorder leftBorder7 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color22 = new Color() { Indexed = (UInt32Value)64U }; leftBorder7.Append(color22); RightBorder rightBorder7 = new RightBorder(); TopBorder topBorder7 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color23 = new Color() { Indexed = (UInt32Value)64U }; topBorder7.Append(color23); BottomBorder bottomBorder7 = new BottomBorder(); DiagonalBorder diagonalBorder7 = new DiagonalBorder(); border7.Append(leftBorder7); border7.Append(rightBorder7); border7.Append(topBorder7); border7.Append(bottomBorder7); border7.Append(diagonalBorder7); Border border8 = new Border(); LeftBorder leftBorder8 = new LeftBorder(); RightBorder rightBorder8 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color24 = new Color() { Indexed = (UInt32Value)64U }; rightBorder8.Append(color24); TopBorder topBorder8 = new TopBorder(); BottomBorder bottomBorder8 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color25 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder8.Append(color25); DiagonalBorder diagonalBorder8 = new DiagonalBorder(); border8.Append(leftBorder8); border8.Append(rightBorder8); border8.Append(topBorder8); border8.Append(bottomBorder8); border8.Append(diagonalBorder8); Border border9 = new Border(); LeftBorder leftBorder9 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color26 = new Color() { Indexed = (UInt32Value)64U }; leftBorder9.Append(color26); RightBorder rightBorder9 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color27 = new Color() { Indexed = (UInt32Value)64U }; rightBorder9.Append(color27); TopBorder topBorder9 = new TopBorder(); BottomBorder bottomBorder9 = new BottomBorder(); DiagonalBorder diagonalBorder9 = new DiagonalBorder(); border9.Append(leftBorder9); border9.Append(rightBorder9); border9.Append(topBorder9); border9.Append(bottomBorder9); border9.Append(diagonalBorder9); Border border10 = new Border(); LeftBorder leftBorder10 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color28 = new Color() { Indexed = (UInt32Value)64U }; leftBorder10.Append(color28); RightBorder rightBorder10 = new RightBorder(); TopBorder topBorder10 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color29 = new Color() { Indexed = (UInt32Value)64U }; topBorder10.Append(color29); BottomBorder bottomBorder10 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color30 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder10.Append(color30); DiagonalBorder diagonalBorder10 = new DiagonalBorder(); border10.Append(leftBorder10); border10.Append(rightBorder10); border10.Append(topBorder10); border10.Append(bottomBorder10); border10.Append(diagonalBorder10); Border border11 = new Border(); LeftBorder leftBorder11 = new LeftBorder(); RightBorder rightBorder11 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color31 = new Color() { Indexed = (UInt32Value)64U }; rightBorder11.Append(color31); TopBorder topBorder11 = new TopBorder(); BottomBorder bottomBorder11 = new BottomBorder(); DiagonalBorder diagonalBorder11 = new DiagonalBorder(); border11.Append(leftBorder11); border11.Append(rightBorder11); border11.Append(topBorder11); border11.Append(bottomBorder11); border11.Append(diagonalBorder11); Border border12 = new Border(); LeftBorder leftBorder12 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color32 = new Color() { Indexed = (UInt32Value)64U }; leftBorder12.Append(color32); RightBorder rightBorder12 = new RightBorder(); TopBorder topBorder12 = new TopBorder(); BottomBorder bottomBorder12 = new BottomBorder(); DiagonalBorder diagonalBorder12 = new DiagonalBorder(); border12.Append(leftBorder12); border12.Append(rightBorder12); border12.Append(topBorder12); border12.Append(bottomBorder12); border12.Append(diagonalBorder12); Border border13 = new Border(); LeftBorder leftBorder13 = new LeftBorder() { Style = BorderStyleValues.Medium }; Color color33 = new Color() { Indexed = (UInt32Value)64U }; leftBorder13.Append(color33); RightBorder rightBorder13 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color34 = new Color() { Indexed = (UInt32Value)64U }; rightBorder13.Append(color34); TopBorder topBorder13 = new TopBorder() { Style = BorderStyleValues.Medium }; Color color35 = new Color() { Indexed = (UInt32Value)64U }; topBorder13.Append(color35); BottomBorder bottomBorder13 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color36 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder13.Append(color36); DiagonalBorder diagonalBorder13 = new DiagonalBorder(); border13.Append(leftBorder13); border13.Append(rightBorder13); border13.Append(topBorder13); border13.Append(bottomBorder13); border13.Append(diagonalBorder13); Border border14 = new Border(); LeftBorder leftBorder14 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color37 = new Color() { Indexed = (UInt32Value)64U }; leftBorder14.Append(color37); RightBorder rightBorder14 = new RightBorder() { Style = BorderStyleValues.Medium }; Color color38 = new Color() { Indexed = (UInt32Value)64U }; rightBorder14.Append(color38); TopBorder topBorder14 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color39 = new Color() { Indexed = (UInt32Value)64U }; topBorder14.Append(color39); BottomBorder bottomBorder14 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color40 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder14.Append(color40); DiagonalBorder diagonalBorder14 = new DiagonalBorder(); border14.Append(leftBorder14); border14.Append(rightBorder14); border14.Append(topBorder14); border14.Append(bottomBorder14); border14.Append(diagonalBorder14); Border border15 = new Border(); LeftBorder leftBorder15 = new LeftBorder() { Style = BorderStyleValues.Medium }; Color color41 = new Color() { Indexed = (UInt32Value)64U }; leftBorder15.Append(color41); RightBorder rightBorder15 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color42 = new Color() { Indexed = (UInt32Value)64U }; rightBorder15.Append(color42); TopBorder topBorder15 = new TopBorder(); BottomBorder bottomBorder15 = new BottomBorder() { Style = BorderStyleValues.Medium }; Color color43 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder15.Append(color43); DiagonalBorder diagonalBorder15 = new DiagonalBorder(); border15.Append(leftBorder15); border15.Append(rightBorder15); border15.Append(topBorder15); border15.Append(bottomBorder15); border15.Append(diagonalBorder15); Border border16 = new Border(); LeftBorder leftBorder16 = new LeftBorder(); RightBorder rightBorder16 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color44 = new Color() { Indexed = (UInt32Value)64U }; rightBorder16.Append(color44); TopBorder topBorder16 = new TopBorder(); BottomBorder bottomBorder16 = new BottomBorder() { Style = BorderStyleValues.Medium }; Color color45 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder16.Append(color45); DiagonalBorder diagonalBorder16 = new DiagonalBorder(); border16.Append(leftBorder16); border16.Append(rightBorder16); border16.Append(topBorder16); border16.Append(bottomBorder16); border16.Append(diagonalBorder16); Border border17 = new Border(); LeftBorder leftBorder17 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color46 = new Color() { Indexed = (UInt32Value)64U }; leftBorder17.Append(color46); RightBorder rightBorder17 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color47 = new Color() { Indexed = (UInt32Value)64U }; rightBorder17.Append(color47); TopBorder topBorder17 = new TopBorder(); BottomBorder bottomBorder17 = new BottomBorder() { Style = BorderStyleValues.Medium }; Color color48 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder17.Append(color48); DiagonalBorder diagonalBorder17 = new DiagonalBorder(); border17.Append(leftBorder17); border17.Append(rightBorder17); border17.Append(topBorder17); border17.Append(bottomBorder17); border17.Append(diagonalBorder17); Border border18 = new Border(); LeftBorder leftBorder18 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color49 = new Color() { Indexed = (UInt32Value)64U }; leftBorder18.Append(color49); RightBorder rightBorder18 = new RightBorder() { Style = BorderStyleValues.Medium }; Color color50 = new Color() { Indexed = (UInt32Value)64U }; rightBorder18.Append(color50); TopBorder topBorder18 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color51 = new Color() { Indexed = (UInt32Value)64U }; topBorder18.Append(color51); BottomBorder bottomBorder18 = new BottomBorder() { Style = BorderStyleValues.Medium }; Color color52 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder18.Append(color52); DiagonalBorder diagonalBorder18 = new DiagonalBorder(); border18.Append(leftBorder18); border18.Append(rightBorder18); border18.Append(topBorder18); border18.Append(bottomBorder18); border18.Append(diagonalBorder18); Border border19 = new Border(); LeftBorder leftBorder19 = new LeftBorder(); RightBorder rightBorder19 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color53 = new Color() { Indexed = (UInt32Value)64U }; rightBorder19.Append(color53); TopBorder topBorder19 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color54 = new Color() { Indexed = (UInt32Value)64U }; topBorder19.Append(color54); BottomBorder bottomBorder19 = new BottomBorder(); DiagonalBorder diagonalBorder19 = new DiagonalBorder(); border19.Append(leftBorder19); border19.Append(rightBorder19); border19.Append(topBorder19); border19.Append(bottomBorder19); border19.Append(diagonalBorder19); Border border20 = new Border(); LeftBorder leftBorder20 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color55 = new Color() { Indexed = (UInt32Value)64U }; leftBorder20.Append(color55); RightBorder rightBorder20 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color56 = new Color() { Indexed = (UInt32Value)64U }; rightBorder20.Append(color56); TopBorder topBorder20 = new TopBorder() { Style = BorderStyleValues.Medium }; Color color57 = new Color() { Indexed = (UInt32Value)64U }; topBorder20.Append(color57); BottomBorder bottomBorder20 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color58 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder20.Append(color58); DiagonalBorder diagonalBorder20 = new DiagonalBorder(); border20.Append(leftBorder20); border20.Append(rightBorder20); border20.Append(topBorder20); border20.Append(bottomBorder20); border20.Append(diagonalBorder20); Border border21 = new Border(); LeftBorder leftBorder21 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color59 = new Color() { Indexed = (UInt32Value)64U }; leftBorder21.Append(color59); RightBorder rightBorder21 = new RightBorder() { Style = BorderStyleValues.Medium }; Color color60 = new Color() { Indexed = (UInt32Value)64U }; rightBorder21.Append(color60); TopBorder topBorder21 = new TopBorder() { Style = BorderStyleValues.Medium }; Color color61 = new Color() { Indexed = (UInt32Value)64U }; topBorder21.Append(color61); BottomBorder bottomBorder21 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color62 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder21.Append(color62); DiagonalBorder diagonalBorder21 = new DiagonalBorder(); border21.Append(leftBorder21); border21.Append(rightBorder21); border21.Append(topBorder21); border21.Append(bottomBorder21); border21.Append(diagonalBorder21); Border border22 = new Border(); LeftBorder leftBorder22 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color63 = new Color() { Indexed = (UInt32Value)64U }; leftBorder22.Append(color63); RightBorder rightBorder22 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color64 = new Color() { Indexed = (UInt32Value)64U }; rightBorder22.Append(color64); TopBorder topBorder22 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color65 = new Color() { Indexed = (UInt32Value)64U }; topBorder22.Append(color65); BottomBorder bottomBorder22 = new BottomBorder() { Style = BorderStyleValues.Medium }; Color color66 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder22.Append(color66); DiagonalBorder diagonalBorder22 = new DiagonalBorder(); border22.Append(leftBorder22); border22.Append(rightBorder22); border22.Append(topBorder22); border22.Append(bottomBorder22); border22.Append(diagonalBorder22); Border border23 = new Border(); LeftBorder leftBorder23 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color67 = new Color() { Indexed = (UInt32Value)64U }; leftBorder23.Append(color67); RightBorder rightBorder23 = new RightBorder() { Style = BorderStyleValues.Medium }; Color color68 = new Color() { Indexed = (UInt32Value)64U }; rightBorder23.Append(color68); TopBorder topBorder23 = new TopBorder(); BottomBorder bottomBorder23 = new BottomBorder() { Style = BorderStyleValues.Medium }; Color color69 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder23.Append(color69); DiagonalBorder diagonalBorder23 = new DiagonalBorder(); border23.Append(leftBorder23); border23.Append(rightBorder23); border23.Append(topBorder23); border23.Append(bottomBorder23); border23.Append(diagonalBorder23); Border border24 = new Border(); LeftBorder leftBorder24 = new LeftBorder() { Style = BorderStyleValues.Medium }; Color color70 = new Color() { Indexed = (UInt32Value)64U }; leftBorder24.Append(color70); RightBorder rightBorder24 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color71 = new Color() { Indexed = (UInt32Value)64U }; rightBorder24.Append(color71); TopBorder topBorder24 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color72 = new Color() { Indexed = (UInt32Value)64U }; topBorder24.Append(color72); BottomBorder bottomBorder24 = new BottomBorder() { Style = BorderStyleValues.Thin }; Color color73 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder24.Append(color73); DiagonalBorder diagonalBorder24 = new DiagonalBorder(); border24.Append(leftBorder24); border24.Append(rightBorder24); border24.Append(topBorder24); border24.Append(bottomBorder24); border24.Append(diagonalBorder24); Border border25 = new Border(); LeftBorder leftBorder25 = new LeftBorder() { Style = BorderStyleValues.Medium }; Color color74 = new Color() { Indexed = (UInt32Value)64U }; leftBorder25.Append(color74); RightBorder rightBorder25 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color75 = new Color() { Indexed = (UInt32Value)64U }; rightBorder25.Append(color75); TopBorder topBorder25 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color76 = new Color() { Indexed = (UInt32Value)64U }; topBorder25.Append(color76); BottomBorder bottomBorder25 = new BottomBorder() { Style = BorderStyleValues.Medium }; Color color77 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder25.Append(color77); DiagonalBorder diagonalBorder25 = new DiagonalBorder(); border25.Append(leftBorder25); border25.Append(rightBorder25); border25.Append(topBorder25); border25.Append(bottomBorder25); border25.Append(diagonalBorder25); Border border26 = new Border(); LeftBorder leftBorder26 = new LeftBorder() { Style = BorderStyleValues.Medium }; Color color78 = new Color() { Indexed = (UInt32Value)64U }; leftBorder26.Append(color78); RightBorder rightBorder26 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color79 = new Color() { Indexed = (UInt32Value)64U }; rightBorder26.Append(color79); TopBorder topBorder26 = new TopBorder() { Style = BorderStyleValues.Medium }; Color color80 = new Color() { Indexed = (UInt32Value)64U }; topBorder26.Append(color80); BottomBorder bottomBorder26 = new BottomBorder() { Style = BorderStyleValues.Medium }; Color color81 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder26.Append(color81); DiagonalBorder diagonalBorder26 = new DiagonalBorder(); border26.Append(leftBorder26); border26.Append(rightBorder26); border26.Append(topBorder26); border26.Append(bottomBorder26); border26.Append(diagonalBorder26); Border border27 = new Border(); LeftBorder leftBorder27 = new LeftBorder() { Style = BorderStyleValues.Thin }; Color color82 = new Color() { Indexed = (UInt32Value)64U }; leftBorder27.Append(color82); RightBorder rightBorder27 = new RightBorder() { Style = BorderStyleValues.Thin }; Color color83 = new Color() { Indexed = (UInt32Value)64U }; rightBorder27.Append(color83); TopBorder topBorder27 = new TopBorder() { Style = BorderStyleValues.Medium }; Color color84 = new Color() { Indexed = (UInt32Value)64U }; topBorder27.Append(color84); BottomBorder bottomBorder27 = new BottomBorder() { Style = BorderStyleValues.Medium }; Color color85 = new Color() { Indexed = (UInt32Value)64U }; bottomBorder27.Append(color85); DiagonalBorder diagonalBorder27 = new DiagonalBorder(); border27.Append(leftBorder27); border27.Append(rightBorder27); border27.Append(topBorder27); border27.Append(bottomBorder27); border27.Append(diagonalBorder27); borders1.Append(border1); borders1.Append(border2); borders1.Append(border3); borders1.Append(border4); borders1.Append(border5); borders1.Append(border6); borders1.Append(border7); borders1.Append(border8); borders1.Append(border9); borders1.Append(border10); borders1.Append(border11); borders1.Append(border12); borders1.Append(border13); borders1.Append(border14); borders1.Append(border15); borders1.Append(border16); borders1.Append(border17); borders1.Append(border18); borders1.Append(border19); borders1.Append(border20); borders1.Append(border21); borders1.Append(border22); borders1.Append(border23); borders1.Append(border24); borders1.Append(border25); borders1.Append(border26); borders1.Append(border27); CellStyleFormats cellStyleFormats1 = new CellStyleFormats() { Count = (UInt32Value)1U }; CellFormat cellFormat1 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U }; cellStyleFormats1.Append(cellFormat1); CellFormats cellFormats1 = new CellFormats() { Count = (UInt32Value)95U }; CellFormat cellFormat2 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; CellFormat cellFormat3 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)9U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment1 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat3.Append(alignment1); CellFormat cellFormat4 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)9U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyProtection = true }; CellFormat cellFormat5 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyProtection = true }; CellFormat cellFormat6 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyProtection = true }; CellFormat cellFormat7 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment2 = new Alignment() { Horizontal = HorizontalAlignmentValues.CenterContinuous }; cellFormat7.Append(alignment2); CellFormat cellFormat8 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment3 = new Alignment() { Horizontal = HorizontalAlignmentValues.CenterContinuous }; cellFormat8.Append(alignment3); CellFormat cellFormat9 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyProtection = true }; CellFormat cellFormat10 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment4 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat10.Append(alignment4); CellFormat cellFormat11 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyProtection = true }; CellFormat cellFormat12 = new CellFormat() { NumberFormatId = (UInt32Value)17U, FontId = (UInt32Value)5U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment5 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; cellFormat12.Append(alignment5); CellFormat cellFormat13 = new CellFormat() { NumberFormatId = (UInt32Value)166U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment6 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; cellFormat13.Append(alignment6); CellFormat cellFormat14 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment7 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat14.Append(alignment7); CellFormat cellFormat15 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment8 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; cellFormat15.Append(alignment8); CellFormat cellFormat16 = new CellFormat() { NumberFormatId = (UInt32Value)17U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment9 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; cellFormat16.Append(alignment9); CellFormat cellFormat17 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)13U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyProtection = true }; CellFormat cellFormat18 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)6U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyProtection = true }; CellFormat cellFormat19 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)9U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment10 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center }; cellFormat19.Append(alignment10); CellFormat cellFormat20 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)5U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment11 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat20.Append(alignment11); CellFormat cellFormat21 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)6U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment12 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat21.Append(alignment12); CellFormat cellFormat22 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)3U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment13 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat22.Append(alignment13); CellFormat cellFormat23 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)4U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment14 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat23.Append(alignment14); CellFormat cellFormat24 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)8U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment15 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat24.Append(alignment15); CellFormat cellFormat25 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)10U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment16 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat25.Append(alignment16); CellFormat cellFormat26 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)4U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)8U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment17 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat26.Append(alignment17); CellFormat cellFormat27 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)4U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)11U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment18 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat27.Append(alignment18); CellFormat cellFormat28 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)4U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)18U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment19 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat28.Append(alignment19); CellFormat cellFormat29 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment20 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat29.Append(alignment20); CellFormat cellFormat30 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)7U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment21 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat30.Append(alignment21); CellFormat cellFormat31 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)11U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyBorder = true, ApplyProtection = true }; CellFormat cellFormat32 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)12U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyProtection = true }; CellFormat cellFormat33 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)19U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment22 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat33.Append(alignment22); CellFormat cellFormat34 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)20U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment23 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat34.Append(alignment23); CellFormat cellFormat35 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)8U, BorderId = (UInt32Value)7U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment24 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat35.Append(alignment24); CellFormat cellFormat36 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)8U, BorderId = (UInt32Value)4U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment25 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat36.Append(alignment25); CellFormat cellFormat37 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)8U, BorderId = (UInt32Value)4U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment26 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat37.Append(alignment26); CellFormat cellFormat38 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)4U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment27 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat38.Append(alignment27); CellFormat cellFormat39 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)11U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment28 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat39.Append(alignment28); CellFormat cellFormat40 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)13U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment29 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat40.Append(alignment29); CellFormat cellFormat41 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)17U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment30 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat41.Append(alignment30); CellFormat cellFormat42 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)8U, BorderId = (UInt32Value)7U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment31 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat42.Append(alignment31); CellFormat cellFormat43 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)11U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment32 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center, WrapText = true }; cellFormat43.Append(alignment32); CellFormat cellFormat44 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)14U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment33 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat44.Append(alignment33); CellFormat cellFormat45 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)15U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment34 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat45.Append(alignment34); CellFormat cellFormat46 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment35 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat46.Append(alignment35); CellFormat cellFormat47 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)10U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyProtection = true }; CellFormat cellFormat48 = new CellFormat() { NumberFormatId = (UInt32Value)49U, FontId = (UInt32Value)10U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyProtection = true }; CellFormat cellFormat49 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)9U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment36 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat49.Append(alignment36); CellFormat cellFormat50 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)7U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)3U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment37 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat50.Append(alignment37); CellFormat cellFormat51 = new CellFormat() { NumberFormatId = (UInt32Value)167U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)3U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment38 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat51.Append(alignment38); CellFormat cellFormat52 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)10U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyProtection = true }; CellFormat cellFormat53 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)9U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyProtection = true }; CellFormat cellFormat54 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)4U, BorderId = (UInt32Value)9U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment39 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat54.Append(alignment39); CellFormat cellFormat55 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)8U, FillId = (UInt32Value)4U, BorderId = (UInt32Value)3U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment40 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat55.Append(alignment40); CellFormat cellFormat56 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)11U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)5U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment41 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center, WrapText = true }; cellFormat56.Append(alignment41); CellFormat cellFormat57 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)12U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment42 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right, Vertical = VerticalAlignmentValues.Center }; cellFormat57.Append(alignment42); CellFormat cellFormat58 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)11U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment43 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat58.Append(alignment43); CellFormat cellFormat59 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)12U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)4U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment44 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right, Vertical = VerticalAlignmentValues.Center }; cellFormat59.Append(alignment44); CellFormat cellFormat60 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)11U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)4U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment45 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat60.Append(alignment45); CellFormat cellFormat61 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)7U, FillId = (UInt32Value)7U, BorderId = (UInt32Value)4U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyProtection = true }; CellFormat cellFormat62 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)7U, FillId = (UInt32Value)7U, BorderId = (UInt32Value)4U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment46 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat62.Append(alignment46); CellFormat cellFormat63 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment47 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat63.Append(alignment47); CellFormat cellFormat64 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)16U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment48 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat64.Append(alignment48); CellFormat cellFormat65 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)22U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment49 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat65.Append(alignment49); CellFormat cellFormat66 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)23U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyProtection = true }; CellFormat cellFormat67 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)24U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment50 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; cellFormat67.Append(alignment50); CellFormat cellFormat68 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)21U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment51 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat68.Append(alignment51); CellFormat cellFormat69 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)8U, BorderId = (UInt32Value)10U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment52 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat69.Append(alignment52); CellFormat cellFormat70 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)8U, BorderId = (UInt32Value)8U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment53 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat70.Append(alignment53); CellFormat cellFormat71 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)8U, BorderId = (UInt32Value)8U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment54 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat71.Append(alignment54); CellFormat cellFormat72 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)8U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment55 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat72.Append(alignment55); CellFormat cellFormat73 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)25U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment56 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat73.Append(alignment56); CellFormat cellFormat74 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)26U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment57 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat74.Append(alignment57); CellFormat cellFormat75 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)11U, FillId = (UInt32Value)11U, BorderId = (UInt32Value)9U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment58 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat75.Append(alignment58); CellFormat cellFormat76 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)11U, FillId = (UInt32Value)11U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment59 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat76.Append(alignment59); CellFormat cellFormat77 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)11U, FillId = (UInt32Value)11U, BorderId = (UInt32Value)3U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment60 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat77.Append(alignment60); CellFormat cellFormat78 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)7U, FillId = (UInt32Value)12U, BorderId = (UInt32Value)9U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment61 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat78.Append(alignment61); CellFormat cellFormat79 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)7U, FillId = (UInt32Value)12U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment62 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat79.Append(alignment62); CellFormat cellFormat80 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)7U, FillId = (UInt32Value)12U, BorderId = (UInt32Value)3U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment63 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat80.Append(alignment63); CellFormat cellFormat81 = new CellFormat() { NumberFormatId = (UInt32Value)17U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)9U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment64 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center }; cellFormat81.Append(alignment64); CellFormat cellFormat82 = new CellFormat() { NumberFormatId = (UInt32Value)17U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment65 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center }; cellFormat82.Append(alignment65); CellFormat cellFormat83 = new CellFormat() { NumberFormatId = (UInt32Value)17U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)3U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment66 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center }; cellFormat83.Append(alignment66); CellFormat cellFormat84 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)10U, BorderId = (UInt32Value)9U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment67 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center }; cellFormat84.Append(alignment67); CellFormat cellFormat85 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)10U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment68 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center }; cellFormat85.Append(alignment68); CellFormat cellFormat86 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)10U, BorderId = (UInt32Value)3U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment69 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center }; cellFormat86.Append(alignment69); CellFormat cellFormat87 = new CellFormat() { NumberFormatId = (UInt32Value)2U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)8U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment70 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat87.Append(alignment70); CellFormat cellFormat88 = new CellFormat() { NumberFormatId = (UInt32Value)2U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment71 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat88.Append(alignment71); CellFormat cellFormat89 = new CellFormat() { NumberFormatId = (UInt32Value)2U, FontId = (UInt32Value)1U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)4U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment72 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat89.Append(alignment72); CellFormat cellFormat90 = new CellFormat() { NumberFormatId = (UInt32Value)2U, FontId = (UInt32Value)3U, FillId = (UInt32Value)4U, BorderId = (UInt32Value)7U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment73 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat90.Append(alignment73); CellFormat cellFormat91 = new CellFormat() { NumberFormatId = (UInt32Value)4U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment74 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat91.Append(alignment74); CellFormat cellFormat92 = new CellFormat() { NumberFormatId = (UInt32Value)4U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)5U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment75 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat92.Append(alignment75); CellFormat cellFormat93 = new CellFormat() { NumberFormatId = (UInt32Value)4U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)26U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment76 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat93.Append(alignment76); CellFormat cellFormat94 = new CellFormat() { NumberFormatId = (UInt32Value)2U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment77 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat94.Append(alignment77); CellFormat cellFormat95 = new CellFormat() { NumberFormatId = (UInt32Value)2U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)5U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment78 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat95.Append(alignment78); CellFormat cellFormat96 = new CellFormat() { NumberFormatId = (UInt32Value)2U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)26U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true, ApplyProtection = true }; Alignment alignment79 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat96.Append(alignment79); cellFormats1.Append(cellFormat2); cellFormats1.Append(cellFormat3); cellFormats1.Append(cellFormat4); cellFormats1.Append(cellFormat5); cellFormats1.Append(cellFormat6); cellFormats1.Append(cellFormat7); cellFormats1.Append(cellFormat8); cellFormats1.Append(cellFormat9); cellFormats1.Append(cellFormat10); cellFormats1.Append(cellFormat11); cellFormats1.Append(cellFormat12); cellFormats1.Append(cellFormat13); cellFormats1.Append(cellFormat14); cellFormats1.Append(cellFormat15); cellFormats1.Append(cellFormat16); cellFormats1.Append(cellFormat17); cellFormats1.Append(cellFormat18); cellFormats1.Append(cellFormat19); cellFormats1.Append(cellFormat20); cellFormats1.Append(cellFormat21); cellFormats1.Append(cellFormat22); cellFormats1.Append(cellFormat23); cellFormats1.Append(cellFormat24); cellFormats1.Append(cellFormat25); cellFormats1.Append(cellFormat26); cellFormats1.Append(cellFormat27); cellFormats1.Append(cellFormat28); cellFormats1.Append(cellFormat29); cellFormats1.Append(cellFormat30); cellFormats1.Append(cellFormat31); cellFormats1.Append(cellFormat32); cellFormats1.Append(cellFormat33); cellFormats1.Append(cellFormat34); cellFormats1.Append(cellFormat35); cellFormats1.Append(cellFormat36); cellFormats1.Append(cellFormat37); cellFormats1.Append(cellFormat38); cellFormats1.Append(cellFormat39); cellFormats1.Append(cellFormat40); cellFormats1.Append(cellFormat41); cellFormats1.Append(cellFormat42); cellFormats1.Append(cellFormat43); cellFormats1.Append(cellFormat44); cellFormats1.Append(cellFormat45); cellFormats1.Append(cellFormat46); cellFormats1.Append(cellFormat47); cellFormats1.Append(cellFormat48); cellFormats1.Append(cellFormat49); cellFormats1.Append(cellFormat50); cellFormats1.Append(cellFormat51); cellFormats1.Append(cellFormat52); cellFormats1.Append(cellFormat53); cellFormats1.Append(cellFormat54); cellFormats1.Append(cellFormat55); cellFormats1.Append(cellFormat56); cellFormats1.Append(cellFormat57); cellFormats1.Append(cellFormat58); cellFormats1.Append(cellFormat59); cellFormats1.Append(cellFormat60); cellFormats1.Append(cellFormat61); cellFormats1.Append(cellFormat62); cellFormats1.Append(cellFormat63); cellFormats1.Append(cellFormat64); cellFormats1.Append(cellFormat65); cellFormats1.Append(cellFormat66); cellFormats1.Append(cellFormat67); cellFormats1.Append(cellFormat68); cellFormats1.Append(cellFormat69); cellFormats1.Append(cellFormat70); cellFormats1.Append(cellFormat71); cellFormats1.Append(cellFormat72); cellFormats1.Append(cellFormat73); cellFormats1.Append(cellFormat74); cellFormats1.Append(cellFormat75); cellFormats1.Append(cellFormat76); cellFormats1.Append(cellFormat77); cellFormats1.Append(cellFormat78); cellFormats1.Append(cellFormat79); cellFormats1.Append(cellFormat80); cellFormats1.Append(cellFormat81); cellFormats1.Append(cellFormat82); cellFormats1.Append(cellFormat83); cellFormats1.Append(cellFormat84); cellFormats1.Append(cellFormat85); cellFormats1.Append(cellFormat86); cellFormats1.Append(cellFormat87); cellFormats1.Append(cellFormat88); cellFormats1.Append(cellFormat89); cellFormats1.Append(cellFormat90); cellFormats1.Append(cellFormat91); cellFormats1.Append(cellFormat92); cellFormats1.Append(cellFormat93); cellFormats1.Append(cellFormat94); cellFormats1.Append(cellFormat95); cellFormats1.Append(cellFormat96); CellStyles cellStyles1 = new CellStyles() { Count = (UInt32Value)1U }; CellStyle cellStyle1 = new CellStyle() { Name = "Normal", FormatId = (UInt32Value)0U, BuiltinId = (UInt32Value)0U }; cellStyles1.Append(cellStyle1); DifferentialFormats differentialFormats1 = new DifferentialFormats() { Count = (UInt32Value)1U }; DifferentialFormat differentialFormat1 = new DifferentialFormat(); Fill fill14 = new Fill(); PatternFill patternFill14 = new PatternFill() { PatternType = PatternValues.Solid }; BackgroundColor backgroundColor12 = new BackgroundColor() { Indexed = (UInt32Value)9U }; patternFill14.Append(backgroundColor12); fill14.Append(patternFill14); differentialFormat1.Append(fill14); differentialFormats1.Append(differentialFormat1); TableStyles tableStyles1 = new TableStyles() { Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium9", DefaultPivotStyle = "PivotStyleLight16" }; Colors colors1 = new Colors(); IndexedColors indexedColors1 = new IndexedColors(); RgbColor rgbColor1 = new RgbColor() { Rgb = "00000000" }; RgbColor rgbColor2 = new RgbColor() { Rgb = "00FFFFFF" }; RgbColor rgbColor3 = new RgbColor() { Rgb = "00FF0000" }; RgbColor rgbColor4 = new RgbColor() { Rgb = "0000FF00" }; RgbColor rgbColor5 = new RgbColor() { Rgb = "000000FF" }; RgbColor rgbColor6 = new RgbColor() { Rgb = "00FFFF00" }; RgbColor rgbColor7 = new RgbColor() { Rgb = "00FF00FF" }; RgbColor rgbColor8 = new RgbColor() { Rgb = "0000FFFF" }; RgbColor rgbColor9 = new RgbColor() { Rgb = "00000000" }; RgbColor rgbColor10 = new RgbColor() { Rgb = "00FFFFFF" }; RgbColor rgbColor11 = new RgbColor() { Rgb = "00FF0000" }; RgbColor rgbColor12 = new RgbColor() { Rgb = "0000FF00" }; RgbColor rgbColor13 = new RgbColor() { Rgb = "000000FF" }; RgbColor rgbColor14 = new RgbColor() { Rgb = "00FFFF00" }; RgbColor rgbColor15 = new RgbColor() { Rgb = "00FF00FF" }; RgbColor rgbColor16 = new RgbColor() { Rgb = "0000FFFF" }; RgbColor rgbColor17 = new RgbColor() { Rgb = "00800000" }; RgbColor rgbColor18 = new RgbColor() { Rgb = "00008000" }; RgbColor rgbColor19 = new RgbColor() { Rgb = "00000080" }; RgbColor rgbColor20 = new RgbColor() { Rgb = "00808000" }; RgbColor rgbColor21 = new RgbColor() { Rgb = "00800080" }; RgbColor rgbColor22 = new RgbColor() { Rgb = "00008080" }; RgbColor rgbColor23 = new RgbColor() { Rgb = "00C0C0C0" }; RgbColor rgbColor24 = new RgbColor() { Rgb = "00808080" }; RgbColor rgbColor25 = new RgbColor() { Rgb = "008080FF" }; RgbColor rgbColor26 = new RgbColor() { Rgb = "00802060" }; RgbColor rgbColor27 = new RgbColor() { Rgb = "00FFFFC0" }; RgbColor rgbColor28 = new RgbColor() { Rgb = "00A0E0E0" }; RgbColor rgbColor29 = new RgbColor() { Rgb = "00600080" }; RgbColor rgbColor30 = new RgbColor() { Rgb = "00FF8080" }; RgbColor rgbColor31 = new RgbColor() { Rgb = "000080C0" }; RgbColor rgbColor32 = new RgbColor() { Rgb = "00C0C0FF" }; RgbColor rgbColor33 = new RgbColor() { Rgb = "00000080" }; RgbColor rgbColor34 = new RgbColor() { Rgb = "00FF00FF" }; RgbColor rgbColor35 = new RgbColor() { Rgb = "00FFFF00" }; RgbColor rgbColor36 = new RgbColor() { Rgb = "0000FFFF" }; RgbColor rgbColor37 = new RgbColor() { Rgb = "00800080" }; RgbColor rgbColor38 = new RgbColor() { Rgb = "00800000" }; RgbColor rgbColor39 = new RgbColor() { Rgb = "00008080" }; RgbColor rgbColor40 = new RgbColor() { Rgb = "000000FF" }; RgbColor rgbColor41 = new RgbColor() { Rgb = "0000CCFF" }; RgbColor rgbColor42 = new RgbColor() { Rgb = "0069FFFF" }; RgbColor rgbColor43 = new RgbColor() { Rgb = "00CCFFCC" }; RgbColor rgbColor44 = new RgbColor() { Rgb = "00FFFF99" }; RgbColor rgbColor45 = new RgbColor() { Rgb = "00A6CAF0" }; RgbColor rgbColor46 = new RgbColor() { Rgb = "00CC9CCC" }; RgbColor rgbColor47 = new RgbColor() { Rgb = "00CC99FF" }; RgbColor rgbColor48 = new RgbColor() { Rgb = "00E3E3E3" }; RgbColor rgbColor49 = new RgbColor() { Rgb = "003366FF" }; RgbColor rgbColor50 = new RgbColor() { Rgb = "0033CCCC" }; RgbColor rgbColor51 = new RgbColor() { Rgb = "00339933" }; RgbColor rgbColor52 = new RgbColor() { Rgb = "00999933" }; RgbColor rgbColor53 = new RgbColor() { Rgb = "00996633" }; RgbColor rgbColor54 = new RgbColor() { Rgb = "00996666" }; RgbColor rgbColor55 = new RgbColor() { Rgb = "00666699" }; RgbColor rgbColor56 = new RgbColor() { Rgb = "00969696" }; RgbColor rgbColor57 = new RgbColor() { Rgb = "003333CC" }; RgbColor rgbColor58 = new RgbColor() { Rgb = "00336666" }; RgbColor rgbColor59 = new RgbColor() { Rgb = "00003300" }; RgbColor rgbColor60 = new RgbColor() { Rgb = "00333300" }; RgbColor rgbColor61 = new RgbColor() { Rgb = "00663300" }; RgbColor rgbColor62 = new RgbColor() { Rgb = "00993366" }; RgbColor rgbColor63 = new RgbColor() { Rgb = "00333399" }; RgbColor rgbColor64 = new RgbColor() { Rgb = "00424242" }; indexedColors1.Append(rgbColor1); indexedColors1.Append(rgbColor2); indexedColors1.Append(rgbColor3); indexedColors1.Append(rgbColor4); indexedColors1.Append(rgbColor5); indexedColors1.Append(rgbColor6); indexedColors1.Append(rgbColor7); indexedColors1.Append(rgbColor8); indexedColors1.Append(rgbColor9); indexedColors1.Append(rgbColor10); indexedColors1.Append(rgbColor11); indexedColors1.Append(rgbColor12); indexedColors1.Append(rgbColor13); indexedColors1.Append(rgbColor14); indexedColors1.Append(rgbColor15); indexedColors1.Append(rgbColor16); indexedColors1.Append(rgbColor17); indexedColors1.Append(rgbColor18); indexedColors1.Append(rgbColor19); indexedColors1.Append(rgbColor20); indexedColors1.Append(rgbColor21); indexedColors1.Append(rgbColor22); indexedColors1.Append(rgbColor23); indexedColors1.Append(rgbColor24); indexedColors1.Append(rgbColor25); indexedColors1.Append(rgbColor26); indexedColors1.Append(rgbColor27); indexedColors1.Append(rgbColor28); indexedColors1.Append(rgbColor29); indexedColors1.Append(rgbColor30); indexedColors1.Append(rgbColor31); indexedColors1.Append(rgbColor32); indexedColors1.Append(rgbColor33); indexedColors1.Append(rgbColor34); indexedColors1.Append(rgbColor35); indexedColors1.Append(rgbColor36); indexedColors1.Append(rgbColor37); indexedColors1.Append(rgbColor38); indexedColors1.Append(rgbColor39); indexedColors1.Append(rgbColor40); indexedColors1.Append(rgbColor41); indexedColors1.Append(rgbColor42); indexedColors1.Append(rgbColor43); indexedColors1.Append(rgbColor44); indexedColors1.Append(rgbColor45); indexedColors1.Append(rgbColor46); indexedColors1.Append(rgbColor47); indexedColors1.Append(rgbColor48); indexedColors1.Append(rgbColor49); indexedColors1.Append(rgbColor50); indexedColors1.Append(rgbColor51); indexedColors1.Append(rgbColor52); indexedColors1.Append(rgbColor53); indexedColors1.Append(rgbColor54); indexedColors1.Append(rgbColor55); indexedColors1.Append(rgbColor56); indexedColors1.Append(rgbColor57); indexedColors1.Append(rgbColor58); indexedColors1.Append(rgbColor59); indexedColors1.Append(rgbColor60); indexedColors1.Append(rgbColor61); indexedColors1.Append(rgbColor62); indexedColors1.Append(rgbColor63); indexedColors1.Append(rgbColor64); colors1.Append(indexedColors1); stylesheet1.Append(numberingFormats1); stylesheet1.Append(fonts1); stylesheet1.Append(fills1); stylesheet1.Append(borders1); stylesheet1.Append(cellStyleFormats1); stylesheet1.Append(cellFormats1); stylesheet1.Append(cellStyles1); stylesheet1.Append(differentialFormats1); stylesheet1.Append(tableStyles1); stylesheet1.Append(colors1); workbookStylesPart1.Stylesheet = stylesheet1; }
private bool MatchField(IEnumerable<Cell> tcs, FieldCellMap fm, SheetLayout sheetLayout, SharedStringTablePart stringTable, CellFormats formats, List<FieldCellMap> agMaps) { bool foundFld = false; foreach (var fld in sheetLayout.wsLayout.fields.Where(f => f.fldType == FieldType.cell)) { if (foundFld) break; try { switch (fm.cellLoc.dataLayout) { case CellDataLayout.combined: foundFld = MatchCombinedField(fld, fm); break; case CellDataLayout.separate: foundFld = MatchSeparatedField(tcs, fld, fm, stringTable, formats); break; case CellDataLayout.aggregate: // Cell contains an aggregate of fields. Based on { var aggCell = tcs.Where(c => c.CellReference == fm.cellLoc.TitleRef).FirstOrDefault(); var val = Spreadsheet.GetCellValue(aggCell, stringTable.SharedStringTable, formats, null); if (val != null && fm.cellLoc.aggregateCellCnt > 0 && fm.cellLoc.aggregateCellSeparator != null && fm.cellLoc.aggregateCellSeparator.Count() > 0) { var cells = Regex.Split(val.Trim(), fm.cellLoc.aggregateCellSeparator).ToList(); if (cells.Count() == fm.cellLoc.aggregateCellCnt) { var nfms = new List<FieldCellMap>(); foreach(var agv in fm.cellLoc.cellMaps) { FieldCellMap nfm = null; switch (agv.dataLayout) { case CellDataLayout.combined: nfm = new FieldCellMap { Title = cells[agv.aggregateIdx].ToLower(), Value = cells[agv.aggregateIdx], versMap = fm.versMap, cellLoc = new CellLocation { dataLayout = CellDataLayout.combined, TitleRef = fm.cellLoc.TitleRef, ValueRef = fm.cellLoc.ValueRef } }; MatchField(tcs, nfm, sheetLayout, stringTable, formats, agMaps); if (nfm.field != null) nfms.Add(nfm); break; case CellDataLayout.lookup: var nfld1 = sheetLayout.wsLayout.fields.Where(f => f.fldType == FieldType.cell); var nfld2 = nfld1.Where(f => f.titles != null); var nfld = nfld2.FirstOrDefault(f => f.titles.Select(t => t.ToLower()).Contains(agv.lookupString.ToLower())); if (nfld != null) { nfm = new FieldCellMap { Title = agv.lookupString, Value = cells[agv.aggregateIdx], field = nfld, versMap = fm.versMap, cellLoc = new CellLocation { dataLayout = CellDataLayout.separate, TitleRef = fm.cellLoc.TitleRef, ValueRef = fm.cellLoc.ValueRef } }; nfms.Add(nfm); } break; } } if(nfms.Count == fm.cellLoc.cellMaps.Count()) { agMaps.AddRange(nfms); foundFld = true; break; } } } } break; } } catch (Exception ex) { Log.New.Msg(ex); } } return foundFld; }
public static Stylesheet GenerateStylesheet() { Stylesheet stylesheet1 = new Stylesheet() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "x14ac" } }; stylesheet1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); stylesheet1.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"); Fonts fonts1 = new Fonts() { Count = (UInt32Value)3U, KnownFonts = true }; Font font1 = new Font(); FontSize fontSize1 = new FontSize() { Val = 14D }; Color color1 = new Color() { Theme = (UInt32Value)1U }; FontName fontName1 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 }; FontScheme fontScheme1 = new FontScheme() { Val = FontSchemeValues.Minor }; font1.Append(fontSize1); font1.Append(color1); font1.Append(fontName1); font1.Append(fontFamilyNumbering1); font1.Append(fontScheme1); Font font2 = new Font(); Bold bold2 = new Bold(); FontSize fontSize2 = new FontSize() { Val = 18D }; Color color2 = new Color() { Theme = (UInt32Value)1U }; FontName fontName2 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering2 = new FontFamilyNumbering() { Val = 2 }; FontScheme fontScheme2 = new FontScheme() { Val = FontSchemeValues.Minor }; font2.Append(bold2); font2.Append(fontSize2); font2.Append(color2); font2.Append(fontName2); font2.Append(fontFamilyNumbering2); font2.Append(fontScheme2); Font font3 = new Font(); Bold bold1 = new Bold(); FontSize fontSize3 = new FontSize() { Val = 30D }; Color color3 = new Color() { Theme = (UInt32Value)1U }; FontName fontName3 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering3 = new FontFamilyNumbering() { Val = 2 }; FontScheme fontScheme3 = new FontScheme() { Val = FontSchemeValues.Minor }; font3.Append(bold1); font3.Append(fontSize3); font3.Append(color3); font3.Append(fontName3); font3.Append(fontFamilyNumbering3); font3.Append(fontScheme3); fonts1.Append(font1); fonts1.Append(font2); fonts1.Append(font3); Fills fills1 = new Fills() { Count = (UInt32Value)2U }; // 0 no BG color just normal Excel Fill fill1 = new Fill(); PatternFill patternFill1 = new PatternFill() { PatternType = PatternValues.None }; fill1.Append(patternFill1); // 1 red or open CAT 1 Fill fill2 = new Fill(); PatternFill patternFill2 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor2 = new ForegroundColor() { Rgb = "FFFF0000" }; BackgroundColor backgroundColor2 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill2.Append(foregroundColor2); patternFill2.Append(backgroundColor2); fill2.Append(patternFill2); // 2 silver or N/A Fill fill3 = new Fill(); PatternFill patternFill3 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor3 = new ForegroundColor() { Rgb = "FFCCCCCC" }; BackgroundColor backgroundColor3 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill3.Append(foregroundColor3); patternFill3.Append(backgroundColor3); fill3.Append(patternFill3); // 3 green or NaF Fill fill4 = new Fill(); PatternFill patternFill4 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor4 = new ForegroundColor() { Rgb = "FF50CC83" }; BackgroundColor backgroundColor4 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill4.Append(foregroundColor4); patternFill4.Append(backgroundColor4); fill4.Append(patternFill4); // 4 black&white or Not Reviewed Fill fill5 = new Fill(); PatternFill patternFill5 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor5 = new ForegroundColor() { Rgb = "FFFFFFFF" }; BackgroundColor backgroundColor5 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill5.Append(foregroundColor5); patternFill5.Append(backgroundColor5); fill5.Append(patternFill5); // 5 red or open CAT 1 Fill fill6 = new Fill(); PatternFill patternFill6 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor6 = new ForegroundColor() { Rgb = "FFE53935" }; BackgroundColor backgroundColor6 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill6.Append(foregroundColor6); patternFill6.Append(backgroundColor6); fill6.Append(patternFill6); // 6 orange open CAT 2 Fill fill7 = new Fill(); PatternFill patternFill7 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor7 = new ForegroundColor() { Rgb = "FFFFA500" }; BackgroundColor backgroundColor7 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill7.Append(foregroundColor7); patternFill7.Append(backgroundColor7); fill7.Append(patternFill7); // 7 orange open CAT 3 Fill fill8 = new Fill(); PatternFill patternFill8 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor8 = new ForegroundColor() { Rgb = "FFD8D80E" }; BackgroundColor backgroundColor8 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill8.Append(foregroundColor8); patternFill8.Append(backgroundColor8); fill8.Append(patternFill8); // 8 gray background for any general use Fill fill9 = new Fill(); PatternFill patternFill9 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor9 = new ForegroundColor() { Rgb = "FFBBBBBB" }; BackgroundColor backgroundColor9 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill9.Append(foregroundColor9); patternFill9.Append(backgroundColor9); fill9.Append(patternFill9); fills1.Append(fill1); // these are 0 based when you include in the CellFormat statements below, so 1 off fills1.Append(fill2); fills1.Append(fill3); fills1.Append(fill4); fills1.Append(fill5); fills1.Append(fill6); fills1.Append(fill7); fills1.Append(fill8); fills1.Append(fill9); Borders borders1 = new Borders() { Count = (UInt32Value)1U }; Border border1 = new Border(); LeftBorder leftBorder1 = new LeftBorder(); RightBorder rightBorder1 = new RightBorder(); TopBorder topBorder1 = new TopBorder(); BottomBorder bottomBorder1 = new BottomBorder(); DiagonalBorder diagonalBorder1 = new DiagonalBorder(); border1.Append(leftBorder1); border1.Append(rightBorder1); border1.Append(topBorder1); border1.Append(bottomBorder1); border1.Append(diagonalBorder1); borders1.Append(border1); CellStyleFormats cellStyleFormats1 = new CellStyleFormats() { Count = (UInt32Value)1U }; CellFormat cellFormat1 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U }; cellStyleFormats1.Append(cellFormat1); CellFormats cellFormats1 = new CellFormats() { Count = (UInt32Value)4U }; // style index 0: normal font and wrapping of text for cell rows CellFormat cellFormat2 = new CellFormat(new Alignment() { WrapText = true }) { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; // style index 1: normal font with numerical format CellFormat cellFormat3 = new CellFormat(new Alignment() { WrapText = true }) { NumberFormatId = (UInt32Value)2U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true }; // style index 2: title font of 30 bold CellFormat cellFormat4 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true }; // style index 3: info row under title and header rows font bold size 18 CellFormat cellFormat5 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true }; // fill colors based on the fillx variables above to match the 4 statuses of the checklist vulnerabilities // style index 4: red or Open CellFormat cellFormat6 = new CellFormat(new Alignment() { WrapText = true }) { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; // style index 5: silver or Not Applicable CellFormat cellFormat7 = new CellFormat(new Alignment() { WrapText = true }) { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; // style index 6: green or Not a Finding CellFormat cellFormat8 = new CellFormat(new Alignment() { WrapText = true }) { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; // style index 7: b/w or Not Reviewed CellFormat cellFormat9 = new CellFormat(new Alignment() { WrapText = true }) { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)4U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; // CENTER The content for listings versus the excel export of a checklist above // style index 8: red or Open centered content CellFormat cellFormat10 = new CellFormat(new Alignment() { WrapText = true, Horizontal = HorizontalAlignmentValues.Center }) { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; // style index 9: silver or Not Applicable CellFormat cellFormat11 = new CellFormat(new Alignment() { WrapText = true, Horizontal = HorizontalAlignmentValues.Center }) { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; // style index 10: green or Not a Finding CellFormat cellFormat12 = new CellFormat(new Alignment() { WrapText = true, Horizontal = HorizontalAlignmentValues.Center }) { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; // style index 11: b/w or Not Reviewed CellFormat cellFormat13 = new CellFormat(new Alignment() { WrapText = true, Horizontal = HorizontalAlignmentValues.Center }) { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)4U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; // style index 12: orange Open CAT 2 CellFormat cellFormat14 = new CellFormat(new Alignment() { WrapText = true }) { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; // style index 13: yellow Open CAT 3 CellFormat cellFormat15 = new CellFormat(new Alignment() { WrapText = true }) { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)7U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; // style index 14: orange Open CAT 2 centered CellFormat cellFormat16 = new CellFormat(new Alignment() { WrapText = true, Horizontal = HorizontalAlignmentValues.Center }) { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; // style index 15: yellow Open CAT 3 centered CellFormat cellFormat17 = new CellFormat(new Alignment() { WrapText = true, Horizontal = HorizontalAlignmentValues.Center }) { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)7U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; // style index 16: yellow Open CAT 3 centered CellFormat cellFormat18 = new CellFormat(new Alignment() { WrapText = true }) { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)8U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true }; // add all these formats cellFormats1.Append(cellFormat2); cellFormats1.Append(cellFormat3); cellFormats1.Append(cellFormat4); cellFormats1.Append(cellFormat5); cellFormats1.Append(cellFormat6); cellFormats1.Append(cellFormat7); cellFormats1.Append(cellFormat8); cellFormats1.Append(cellFormat9); cellFormats1.Append(cellFormat10); cellFormats1.Append(cellFormat11); cellFormats1.Append(cellFormat12); cellFormats1.Append(cellFormat13); cellFormats1.Append(cellFormat14); cellFormats1.Append(cellFormat15); cellFormats1.Append(cellFormat16); cellFormats1.Append(cellFormat17); cellFormats1.Append(cellFormat18); CellStyles cellStyles1 = new CellStyles() { Count = (UInt32Value)1U }; CellStyle cellStyle1 = new CellStyle() { Name = "Normal", FormatId = 0, BuiltinId = 0 }; cellStyles1.Append(cellStyle1); DifferentialFormats differentialFormats1 = new DifferentialFormats() { Count = 0 }; TableStyles tableStyles1 = new TableStyles() { Count = 0, DefaultTableStyle = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleLight16" }; StylesheetExtensionList stylesheetExtensionList1 = new StylesheetExtensionList(); StylesheetExtension stylesheetExtension1 = new StylesheetExtension() { Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}" }; stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"); StylesheetExtension stylesheetExtension2 = new StylesheetExtension() { Uri = "{9260A510-F301-46a8-8635-F512D64BE5F5}" }; stylesheetExtension2.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"); stylesheetExtensionList1.Append(stylesheetExtension1); stylesheetExtensionList1.Append(stylesheetExtension2); stylesheet1.Append(fonts1); stylesheet1.Append(fills1); stylesheet1.Append(borders1); stylesheet1.Append(cellStyleFormats1); stylesheet1.Append(cellFormats1); stylesheet1.Append(cellStyles1); stylesheet1.Append(differentialFormats1); stylesheet1.Append(tableStyles1); stylesheet1.Append(stylesheetExtensionList1); return(stylesheet1); }
private static Stylesheet GenerateStylesheet() { Stylesheet styleSheet = null; DocumentFormat.OpenXml.Spreadsheet.Fonts fonts = new DocumentFormat.OpenXml.Spreadsheet.Fonts( new DocumentFormat.OpenXml.Spreadsheet.Font( // Index 0 - default new DocumentFormat.OpenXml.Spreadsheet.FontSize() { Val = 14 } ), new DocumentFormat.OpenXml.Spreadsheet.Font( // Index 1 - header new DocumentFormat.OpenXml.Spreadsheet.FontSize() { Val = 14 }, new DocumentFormat.OpenXml.Spreadsheet.Bold(), new DocumentFormat.OpenXml.Spreadsheet.Color() { Rgb = "FFFFFF" } )); Fills fills = new Fills( new Fill(new PatternFill() { PatternType = PatternValues.None }), new Fill(new PatternFill() { PatternType = PatternValues.Gray125 }), new Fill(new PatternFill(new ForegroundColor { Rgb = new HexBinaryValue() { Value = "66666666" } }) { PatternType = PatternValues.Solid }), new Fill(new PatternFill(new ForegroundColor { Rgb = new HexBinaryValue() { Value = "00056F33" } }) { PatternType = PatternValues.Solid }), new Fill(new PatternFill(new ForegroundColor { Rgb = new HexBinaryValue() { Value = "0017982E" } }) { PatternType = PatternValues.Solid }), new Fill(new PatternFill(new ForegroundColor { Rgb = new HexBinaryValue() { Value = "008DC153" } }) { PatternType = PatternValues.Solid }), new Fill(new PatternFill(new ForegroundColor { Rgb = new HexBinaryValue() { Value = "00F6BB43" } }) { PatternType = PatternValues.Solid }), new Fill(new PatternFill(new ForegroundColor { Rgb = new HexBinaryValue() { Value = "00E77E23" } }) { PatternType = PatternValues.Solid }), new Fill(new PatternFill(new ForegroundColor { Rgb = new HexBinaryValue() { Value = "00E9573E" } }) { PatternType = PatternValues.Solid }), new Fill(new PatternFill(new ForegroundColor { Rgb = new HexBinaryValue() { Value = "00838383" } }) { PatternType = PatternValues.Solid }) ); Borders borders = new Borders( new DocumentFormat.OpenXml.Spreadsheet.Border(), // index 0 default new DocumentFormat.OpenXml.Spreadsheet.Border( // index 1 black border new DocumentFormat.OpenXml.Spreadsheet.LeftBorder(new DocumentFormat.OpenXml.Spreadsheet.Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new DocumentFormat.OpenXml.Spreadsheet.RightBorder(new DocumentFormat.OpenXml.Spreadsheet.Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new DocumentFormat.OpenXml.Spreadsheet.TopBorder(new DocumentFormat.OpenXml.Spreadsheet.Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new DocumentFormat.OpenXml.Spreadsheet.BottomBorder(new DocumentFormat.OpenXml.Spreadsheet.Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new DiagonalBorder()) ); CellFormats cellFormats = new CellFormats( new CellFormat(), // default new CellFormat { FontId = 0, FillId = 0, BorderId = 1, ApplyBorder = true }, // body new CellFormat { FontId = 1, FillId = 2, BorderId = 1, ApplyFill = true }, new CellFormat { FontId = 1, FillId = 3, BorderId = 1, ApplyFill = true }, new CellFormat { FontId = 1, FillId = 4, BorderId = 1, ApplyFill = true }, new CellFormat { FontId = 1, FillId = 5, BorderId = 1, ApplyFill = true }, new CellFormat { FontId = 1, FillId = 6, BorderId = 1, ApplyFill = true }, new CellFormat { FontId = 1, FillId = 7, BorderId = 1, ApplyFill = true }, new CellFormat { FontId = 1, FillId = 8, BorderId = 1, ApplyFill = true }, new CellFormat { FontId = 1, FillId = 9, BorderId = 1, ApplyFill = true } ); styleSheet = new Stylesheet(fonts, fills, borders, cellFormats); return(styleSheet); }
private Stylesheet GenerateStylesheet(IEnumerable <SheetCellItem> cellItems) { if (cellItems != null && cellItems.Any(x => x.CellFormats != null)) { IEnumerable <SheetCellFormats> cfs = cellItems.Where(x => x.CellFormats != null).Select(x => x.CellFormats).Distinct(); Fills fills = new Fills(new Fill(new PatternFill() { PatternType = PatternValues.None }), new Fill(new PatternFill() { PatternType = PatternValues.Gray125 })); Dictionary <string, Fill> fgColorAndFills = new Dictionary <string, Fill>(); if (cfs.Any(x => !string.IsNullOrEmpty(x.FGColor))) { foreach (var fg in cfs.Where(x => !string.IsNullOrEmpty(x.FGColor)).Select(x => x.FGColor).Distinct()) { var f = new Fill(new PatternFill() { PatternType = PatternValues.Solid, ForegroundColor = new ForegroundColor() { Rgb = new HexBinaryValue(fg) } }); fgColorAndFills.Add(fg, f); fills.AppendChild(f); } } Fonts fonts = new Fonts(new Font(new FontSize() { Val = 10 }), new Font(new FontSize() { Val = 10 }, new FontName() { Val = "Arial" })); Borders borders = new Borders(new Border(), new Border( new LeftBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new RightBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new TopBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new BottomBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new DiagonalBorder()), new Border(new TopBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }), new Border(new RightBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }), new Border(new BottomBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }), new Border(new LeftBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin })); CellFormat[] lstCellFormats = new CellFormat[cfs.Count() + 1]; lstCellFormats[0] = (new CellFormat() { FillId = 0, FontId = 0 }); uint index = 1; bool tag = false; foreach (SheetCellFormats itm in cfs) { tag = false; CellFormat cf = new CellFormat(); if (itm.FontBold || itm.FontSize > 0 || !string.IsNullOrEmpty(itm.FontColor) || !string.IsNullOrEmpty(itm.FontName)) { var f = new Font(); if (itm.FontSize > 0) { f.Append(new FontSize() { Val = itm.FontSize }); } if (itm.FontBold) { f.Append(new Bold() { Val = true }); } if (!string.IsNullOrEmpty(itm.FontColor)) { f.Append(new Color { Rgb = itm.FontColor }); } if (!string.IsNullOrEmpty(itm.FontName)) { f.Append(new FontName { Val = itm.FontName }); } int i = FindFont(fonts, f); if (i > -1) { cf.FontId = (uint)i; } else { fonts.Append(f); cf.FontId = (uint)(fonts.ChildElements.Count - 1); } cf.ApplyFont = true; tag = true; } if (itm.HorizontalAlignment != HorizontalAlignments.Default || itm.VerticalAlignment != VerticalAlignments.Default || itm.WrapText) { var align = new Alignment(); switch (itm.HorizontalAlignment) { case HorizontalAlignments.Default: break; case HorizontalAlignments.Center: align.Horizontal = HorizontalAlignmentValues.Center; break; case HorizontalAlignments.Left: align.Horizontal = HorizontalAlignmentValues.Left; break; case HorizontalAlignments.Right: align.Horizontal = HorizontalAlignmentValues.Right; break; } switch (itm.VerticalAlignment) { case VerticalAlignments.Default: break; case VerticalAlignments.Top: align.Vertical = VerticalAlignmentValues.Top; break; case VerticalAlignments.Middle: align.Vertical = VerticalAlignmentValues.Center; break; case VerticalAlignments.Bottom: align.Vertical = VerticalAlignmentValues.Bottom; break; } align.WrapText = itm.WrapText; cf.Append(align); cf.ApplyAlignment = true; tag = true; } if (tag) { cf.FillId = 0; lstCellFormats[index] = cf; } index++; } index = 1; foreach (SheetCellFormats itm in cfs) { if (itm.Borders != null && itm.Borders.Any(x => x == true)) { if (itm.FontBold || itm.FontSize > 0 || !string.IsNullOrEmpty(itm.FontColor) || !string.IsNullOrEmpty(itm.FontName) || itm.HorizontalAlignment != HorizontalAlignments.Default || itm.VerticalAlignment != VerticalAlignments.Default) { if (itm.Borders[0] && itm.Borders[1] && itm.Borders[2] && itm.Borders[3]) { lstCellFormats[index].BorderId = 1; } else if (itm.Borders[0]) { lstCellFormats[index].BorderId = 2; } else if (itm.Borders[1]) { lstCellFormats[index].BorderId = 3; } else if (itm.Borders[2]) { lstCellFormats[index].BorderId = 4; } else if (itm.Borders[3]) { lstCellFormats[index].BorderId = 5; } } else { CellFormat fc = new CellFormat(); if (itm.Borders[0] && itm.Borders[1] && itm.Borders[2] && itm.Borders[3]) { fc.BorderId = 1; } else if (itm.Borders[0]) { fc.BorderId = 2; } else if (itm.Borders[1]) { fc.BorderId = 3; } else if (itm.Borders[2]) { fc.BorderId = 4; } else if (itm.Borders[3]) { fc.BorderId = 5; } lstCellFormats[index] = fc; } lstCellFormats[index].ApplyBorder = true; } if (!string.IsNullOrEmpty(itm.FGColor)) { lstCellFormats[index].FillId = (uint)FindForGroundFill(fills, fgColorAndFills[itm.FGColor]); } index++; } index = 1; foreach (SheetCellFormats itm in cfs) { foreach (SheetCellItem x in cellItems.Where(x => x.CellFormats == itm)) { x.FormatIndex = index; } index++; } CellFormats cellFormats = new CellFormats(lstCellFormats); return(new Stylesheet(fonts, fills, borders, cellFormats)); } return(null); }
// Generates content of workbookStylesPart1. private void GenerateWorkbookStylesPart1Content(WorkbookStylesPart workbookStylesPart1) { Stylesheet stylesheet1 = new Stylesheet(); Fonts fonts1 = new Fonts() { Count = (UInt32Value)1U }; Font font1 = new Font(); FontSize fontSize1 = new FontSize() { Val = 11D }; Color color1 = new Color() { Theme = (UInt32Value)1U }; FontName fontName1 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 }; FontScheme fontScheme1 = new FontScheme() { Val = FontSchemeValues.Minor }; font1.Append(fontSize1); font1.Append(color1); font1.Append(fontName1); font1.Append(fontFamilyNumbering1); font1.Append(fontScheme1); fonts1.Append(font1); Fills fills1 = new Fills() { Count = (UInt32Value)2U }; Fill fill1 = new Fill(); PatternFill patternFill1 = new PatternFill() { PatternType = PatternValues.None }; fill1.Append(patternFill1); Fill fill2 = new Fill(); PatternFill patternFill2 = new PatternFill() { PatternType = PatternValues.Gray125 }; fill2.Append(patternFill2); fills1.Append(fill1); fills1.Append(fill2); Borders borders1 = new Borders() { Count = (UInt32Value)1U }; Border border1 = new Border(); LeftBorder leftBorder1 = new LeftBorder(); RightBorder rightBorder1 = new RightBorder(); TopBorder topBorder1 = new TopBorder(); BottomBorder bottomBorder1 = new BottomBorder(); DiagonalBorder diagonalBorder1 = new DiagonalBorder(); border1.Append(leftBorder1); border1.Append(rightBorder1); border1.Append(topBorder1); border1.Append(bottomBorder1); border1.Append(diagonalBorder1); borders1.Append(border1); CellStyleFormats cellStyleFormats1 = new CellStyleFormats() { Count = (UInt32Value)1U }; CellFormat cellFormat1 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U }; cellStyleFormats1.Append(cellFormat1); CellFormats cellFormats1 = new CellFormats() { Count = (UInt32Value)1U }; CellFormat cellFormat2 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; cellFormats1.Append(cellFormat2); CellStyles cellStyles1 = new CellStyles() { Count = (UInt32Value)1U }; CellStyle cellStyle1 = new CellStyle() { Name = "Normal", FormatId = (UInt32Value)0U, BuiltinId = (UInt32Value)0U }; cellStyles1.Append(cellStyle1); DifferentialFormats differentialFormats1 = new DifferentialFormats() { Count = (UInt32Value)3U }; DifferentialFormat differentialFormat1 = new DifferentialFormat(); Font font2 = new Font(); Condense condense1 = new Condense() { Val = false }; Extend extend1 = new Extend() { Val = false }; Color color2 = new Color() { Rgb = "FF9C0006" }; font2.Append(condense1); font2.Append(extend1); font2.Append(color2); Fill fill3 = new Fill(); PatternFill patternFill3 = new PatternFill(); BackgroundColor backgroundColor1 = new BackgroundColor() { Rgb = "FFFFC7CE" }; patternFill3.Append(backgroundColor1); fill3.Append(patternFill3); differentialFormat1.Append(font2); differentialFormat1.Append(fill3); DifferentialFormat differentialFormat2 = new DifferentialFormat(); Font font3 = new Font(); Condense condense2 = new Condense() { Val = false }; Extend extend2 = new Extend() { Val = false }; Color color3 = new Color() { Rgb = "FF006100" }; font3.Append(condense2); font3.Append(extend2); font3.Append(color3); Fill fill4 = new Fill(); PatternFill patternFill4 = new PatternFill(); BackgroundColor backgroundColor2 = new BackgroundColor() { Rgb = "FFC6EFCE" }; patternFill4.Append(backgroundColor2); fill4.Append(patternFill4); differentialFormat2.Append(font3); differentialFormat2.Append(fill4); DifferentialFormat differentialFormat3 = new DifferentialFormat(); Font font4 = new Font(); Condense condense3 = new Condense() { Val = false }; Extend extend3 = new Extend() { Val = false }; Color color4 = new Color() { Rgb = "FF006100" }; font4.Append(condense3); font4.Append(extend3); font4.Append(color4); Fill fill5 = new Fill(); PatternFill patternFill5 = new PatternFill(); BackgroundColor backgroundColor3 = new BackgroundColor() { Rgb = "FFC6EFCE" }; patternFill5.Append(backgroundColor3); fill5.Append(patternFill5); differentialFormat3.Append(font4); differentialFormat3.Append(fill5); differentialFormats1.Append(differentialFormat1); differentialFormats1.Append(differentialFormat2); differentialFormats1.Append(differentialFormat3); TableStyles tableStyles1 = new TableStyles() { Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium9", DefaultPivotStyle = "PivotStyleLight16" }; stylesheet1.Append(fonts1); stylesheet1.Append(fills1); stylesheet1.Append(borders1); stylesheet1.Append(cellStyleFormats1); stylesheet1.Append(cellFormats1); stylesheet1.Append(cellStyles1); stylesheet1.Append(differentialFormats1); stylesheet1.Append(tableStyles1); workbookStylesPart1.Stylesheet = stylesheet1; }
/// <summary> /// 默认样式 /// </summary> /// <param name="sheetDatas"></param> /// <returns></returns> private Stylesheet DefaultStylesheet() { Fonts fonts = new Fonts(new Font(new FontSize() { Val = 10 }, new FontName { Val = "宋体" }), new Font(new FontSize() { Val = 10 }, new Bold() { Val = true }, new Color { Rgb = "993366" }, new FontName { Val = "宋体" })); Fills fills = new Fills(new Fill(new PatternFill() { PatternType = PatternValues.None }), new Fill(new PatternFill() { PatternType = PatternValues.Gray125 }), new Fill(new PatternFill() { PatternType = PatternValues.Solid, ForegroundColor = new ForegroundColor() { Rgb = new HexBinaryValue("C0C0C0") } })); Borders borders = new Borders(new Border(), new Border(new LeftBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new RightBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new TopBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new BottomBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new DiagonalBorder())); CellFormat headFormat = new CellFormat { FontId = 1, ApplyFont = true, FillId = 2, BorderId = 1, ApplyBorder = true }; CellFormat dataFormat = new CellFormat { FontId = 0, ApplyFont = true, FillId = 0, BorderId = 1, ApplyBorder = true }; CellFormats cellFormats = new CellFormats(new CellFormat() { FillId = 0, FontId = 0 }, headFormat, dataFormat); return(new Stylesheet(fonts, fills, borders, cellFormats)); }
private DocumentFormat.OpenXml.Spreadsheet.CellFormats CreateCellFormats() { var cellFormats = new CellFormats(); /*CellFormatStyles.Add(CellFormatStyle.Empty, new CellFormat { NumberFormatId = 0, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0 }); cellFormats.Append(CellFormatStyles[CellFormatStyle.Empty]);*/ // index 1 // Cell Standard Date format /* CellFormatStyles.Add(CellFormatStyle.Date, new CellFormat { Alignment = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }, NumberFormatId = 14, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }); cellFormats.Append(CellFormatStyles[CellFormatStyle.Date]); // Index 2 // Cell Standard Number format with 2 decimal placing CellFormatStyles.Add(CellFormatStyle.NumberDecimal2, new CellFormat { NumberFormatId = 4, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }); cellFormats.Append(CellFormatStyles[CellFormatStyle.NumberDecimal2]); // Index 3 // Cell Date time custom format CellFormatStyles.Add(CellFormatStyle.DateTime, new CellFormat { NumberFormatId = NumberStyles[NumberStyle.Date].NumberFormatId, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }); cellFormats.Append(CellFormatStyles[CellFormatStyle.DateTime]); // Index 4 // Cell 4 decimal custom format CellFormatStyles.Add(CellFormatStyle.NumberDecimal4, new CellFormat { NumberFormatId = NumberStyles[NumberStyle.Decimal4].NumberFormatId, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }); cellFormats.Append(CellFormatStyles[CellFormatStyle.NumberDecimal4]); CellFormatStyles.Add(CellFormatStyle.DateBorder, new CellFormat { Alignment = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }, NumberFormatId = NumberStyles[NumberStyle.Date].NumberFormatId, FontId = 0, FillId = 0, BorderId = 3, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }); cellFormats.Append(CellFormatStyles[CellFormatStyle.DateBorder]); /* // Index 5 // Cell 2 decimal custom format cellFormat = new CellFormat { NumberFormatId = NumberStyles[NumberStyle.Decimal2].NumberFormatId, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }; cellFormats.Append(cellFormat); // Index 6 // Cell forced number text custom format cellFormat = new CellFormat { NumberFormatId = NumberStyles[NumberStyle.ForcedText].NumberFormatId, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }; cellFormats.Append(cellFormat); // Index 7 // Cell text with font 12 cellFormat = new CellFormat { NumberFormatId = NumberStyles[NumberStyle.ForcedText].NumberFormatId, FontId = 1, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }; cellFormats.Append(cellFormat); // Index 8 // Cell text cellFormat = new CellFormat { Alignment = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }, NumberFormatId = NumberStyles[NumberStyle.ForcedText].NumberFormatId, FontId = 0, FillId = 0, BorderId = 1, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }; cellFormats.Append(cellFormat); // Index 9 // Coloured 2 decimal cell text cellFormat = new CellFormat { NumberFormatId = NumberStyles[NumberStyle.ForcedText].NumberFormatId, FontId = 0, FillId = 2, BorderId = 2, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }; cellFormats.Append(cellFormat); // Index 10 // Coloured cell text cellFormat = new CellFormat { NumberFormatId = NumberStyles[NumberStyle.ForcedText].NumberFormatId, FontId = 0, FillId = 2, BorderId = 2, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }; cellFormats.Append(cellFormat); // Index 11 // Coloured cell text cellFormat = new CellFormat { NumberFormatId = NumberStyles[NumberStyle.ForcedText].NumberFormatId, FontId = 1, FillId = 3, BorderId = 2, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true) }; cellFormats.Append(cellFormat);*/ cellFormats.Count = UInt32Value.FromUInt32((uint)cellFormats.ChildElements.Count); return cellFormats; }
private Stylesheet GenerateStylesheet() { Stylesheet styleSheet = null; // 字体 Fonts fonts = new Fonts( new Font( // 0 默认 ), new Font( // 1 表头 new Bold() )); // 填充 Fills fills = new Fills( new Fill(new PatternFill() { PatternType = PatternValues.None }) // 0 默认 ); // 边框 Borders borders = new Borders( new Border(), // 0 默认 new Border( // 1 四周边框 new LeftBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new RightBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new TopBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new BottomBorder(new Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new DiagonalBorder()) ); CellFormats cellFormats = new CellFormats( new CellFormat(), // 默认 new CellFormat { FontId = 1, FillId = 0, BorderId = 1, ApplyBorder = true }, // 表头 new CellFormat { FontId = 0, FillId = 0, BorderId = 1, ApplyBorder = true } // 内容 ); styleSheet = new Stylesheet(fonts, fills, borders, cellFormats); return(styleSheet); }