private static void CreateBasicFont(Fonts fonts, Color color) { Font font1 = new Font(); FontSize fontSize1 = new FontSize() { Val = 11D }; FontName fontName1 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 }; FontScheme fontScheme1 = new FontScheme() { Val = FontSchemeValues.Minor }; font1.AppendChild(fontSize1); font1.AppendChild(color); font1.AppendChild(fontName1); font1.AppendChild(fontFamilyNumbering1); font1.AppendChild(fontScheme1); fonts.AppendChild(font1); }
static Fonts GenerateFonts() { var fonts = new Fonts { Count = 1U, KnownFonts = true }; var font1 = new Font(); var fontSize1 = new FontSize { Val = 10D }; var color1 = new Color { Theme = 1U }; var fontName1 = new FontName { Val = "Times New Roman" }; var fontFamilyNumbering1 = new FontFamilyNumbering { Val = 1 }; var fontCharSet1 = new FontCharSet { Val = 204 }; font1.Append(fontSize1); font1.Append(color1); font1.Append(fontName1); font1.Append(fontFamilyNumbering1); font1.Append(fontCharSet1); fonts.Append(font1); return(fonts); }
private static void CreateThemeFont(Fonts fonts) { Color color = new Color() { Theme = 1U }; CreateBasicFont(fonts, color); }
private static void CreateColorFont(Fonts fonts) { Color color = new Color() { Rgb = new HexBinaryValue() { Value = "FFFFFF" } }; CreateBasicFont(fonts, color); }
private static Fonts AddFonts() { Fonts fonts1 = new Fonts() { Count = 2U, KnownFonts = true }; CreateThemeFont(fonts1); CreateColorFont(fonts1); return(fonts1); }
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() { 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)); }
private static Stylesheet CreateStylesheet() { Stylesheet stylesheet1 = new Stylesheet(); DocumentFormat.OpenXml.Spreadsheet.Fonts fonts1 = new DocumentFormat.OpenXml.Spreadsheet.Fonts() { Count = (UInt32Value)1U, KnownFonts = true }; DocumentFormat.OpenXml.Spreadsheet.Font font1 = new DocumentFormat.OpenXml.Spreadsheet.Font(); FontSize fontSize1 = new FontSize() { Val = 11 }; Color color1 = new Color() { Theme = (UInt32Value)1U }; FontName fontName1 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 }; DocumentFormat.OpenXml.Spreadsheet.FontScheme fontScheme1 = new DocumentFormat.OpenXml.Spreadsheet.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(); FontSize fontSize2 = new FontSize() { Val = 14 }; Color color2 = new Color() { Rgb = "FF0070C0" }; FontName fontName2 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering2 = new FontFamilyNumbering() { Val = 2 }; DocumentFormat.OpenXml.Spreadsheet.FontScheme fontScheme2 = new DocumentFormat.OpenXml.Spreadsheet.FontScheme() { Val = FontSchemeValues.Minor }; font2.Append(fontSize1); font1.Append(color2); font1.Append(fontName2); font1.Append(fontFamilyNumbering2); font1.Append(fontScheme2); fonts1.Append(font1); fonts1.Append(font2); CellStyleFormats cellStyleFormats1 = new CellStyleFormats() { Count = (UInt32Value)1U }; CellFormat cellFormat1 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U }; cellStyleFormats1.Append(cellFormat1); CellFormats cellFormats1 = new CellFormats() { Count = (UInt32Value)4U }; CellFormat cellFormat2 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U }; CellFormat cellFormat3 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U }; 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); stylesheet1.Append(fonts1); stylesheet1.Append(cellStyleFormats1); stylesheet1.Append(cellFormats1); stylesheet1.Append(cellStyles1); return(stylesheet1); }
private static MSOpenXML.Stylesheet CreateStylesheet(int pQuantidadeDecimais = 2) { MSOpenXML.Stylesheet ss = new MSOpenXML.Stylesheet(); #region Fontes MSOpenXML.Fonts fts = new MSOpenXML.Fonts(); MSOpenXML.Font ft = new MSOpenXML.Font(); MSOpenXML.FontName ftn = new MSOpenXML.FontName(); ftn.Val = "Calibri"; MSOpenXML.FontSize ftsz = new MSOpenXML.FontSize(); ftsz.Val = 11; ft.FontName = ftn; ft.FontSize = ftsz; fts.Append(ft); ft = new MSOpenXML.Font(); ft.Bold = new MSOpenXML.Bold(); ftn = new MSOpenXML.FontName(); ftn.Val = "Calibri"; ftsz = new MSOpenXML.FontSize(); ftsz.Val = 11; ft.FontName = ftn; ft.FontSize = ftsz; fts.Append(ft); fts.Count = (uint)fts.ChildElements.Count; #endregion #region Preenchimento MSOpenXML.Fills fills = new MSOpenXML.Fills(); MSOpenXML.Fill fill; MSOpenXML.PatternFill patternFill; fill = new MSOpenXML.Fill(); patternFill = new MSOpenXML.PatternFill(); patternFill.PatternType = MSOpenXML.PatternValues.None; fill.PatternFill = patternFill; fills.Append(fill); /*fill = new dos.Fill(); * patternFill = new dos.PatternFill(); * patternFill.PatternType = dos.PatternValues.Gray125; * fill.PatternFill = patternFill; * fills.Append(fill); * * fill = new dos.Fill(); * patternFill = new dos.PatternFill(); * patternFill.PatternType = dos.PatternValues.Solid; * patternFill.ForegroundColor = new dos.ForegroundColor(); * patternFill.ForegroundColor.Rgb = HexBinaryValue.FromString("00ff9728"); * patternFill.BackgroundColor = new dos.BackgroundColor(); * patternFill.BackgroundColor.Rgb = patternFill.ForegroundColor.Rgb; * fill.PatternFill = patternFill; * fills.Append(fill); */ fills.Count = (uint)fills.ChildElements.Count; #endregion #region Bordas MSOpenXML.Borders borders = new MSOpenXML.Borders(); MSOpenXML.Border border = new MSOpenXML.Border(); border.LeftBorder = new MSOpenXML.LeftBorder(); border.RightBorder = new MSOpenXML.RightBorder(); border.TopBorder = new MSOpenXML.TopBorder(); border.BottomBorder = new MSOpenXML.BottomBorder(); border.DiagonalBorder = new MSOpenXML.DiagonalBorder(); borders.Append(border); border = new MSOpenXML.Border(); border.LeftBorder = new MSOpenXML.LeftBorder(); border.RightBorder = new MSOpenXML.RightBorder(); border.TopBorder = new MSOpenXML.TopBorder(); border.TopBorder.Style = MSOpenXML.BorderStyleValues.Thin; border.BottomBorder = new MSOpenXML.BottomBorder(); border.DiagonalBorder = new MSOpenXML.DiagonalBorder(); borders.Append(border); borders.Count = (uint)borders.ChildElements.Count; #endregion MSOpenXML.CellStyleFormats csfs = new MSOpenXML.CellStyleFormats(); MSOpenXML.CellFormat cf = new MSOpenXML.CellFormat(); cf.NumberFormatId = 0; cf.FontId = 0; cf.BorderId = 0; cf.Alignment = new MSOpenXML.Alignment() { WrapText = false }; csfs.Append(cf); csfs.Count = (uint)csfs.ChildElements.Count; uint iExcelIndex = 164; MSOpenXML.NumberingFormats nfs = new MSOpenXML.NumberingFormats(); MSOpenXML.CellFormats cfs = new MSOpenXML.CellFormats(); cf = new MSOpenXML.CellFormat(); cf.NumberFormatId = 0; cf.FontId = 0; cf.BorderId = 0; cf.FormatId = 0; cf.Alignment = new MSOpenXML.Alignment() { WrapText = false }; cfs.Append(cf); MSOpenXML.NumberingFormat nfDateTime = new MSOpenXML.NumberingFormat(); nfDateTime.NumberFormatId = iExcelIndex++; nfDateTime.FormatCode = "dd/mm/yyyy"; nfs.Append(nfDateTime); MSOpenXML.NumberingFormat nf4decimal = new MSOpenXML.NumberingFormat(); nf4decimal.NumberFormatId = iExcelIndex++; nf4decimal.FormatCode = "#,##0"; nfs.Append(nf4decimal); // #,##0.00 is also Excel style index 4 MSOpenXML.NumberingFormat nf2decimal = new MSOpenXML.NumberingFormat(); nf2decimal.NumberFormatId = iExcelIndex++; nf2decimal.FormatCode = FormatoDecimal(pQuantidadeDecimais); //"#,##0.00" nfs.Append(nf2decimal); // @ is also Excel style index 49 MSOpenXML.NumberingFormat nfForcedText = new MSOpenXML.NumberingFormat(); nfForcedText.NumberFormatId = iExcelIndex++; nfForcedText.FormatCode = "@"; nfs.Append(nfForcedText); // index 1 cf = new MSOpenXML.CellFormat(); cf.NumberFormatId = nfDateTime.NumberFormatId; cf.FontId = 0; cf.BorderId = 0; cf.FormatId = 0; cf.ApplyNumberFormat = true; cf.Alignment = new MSOpenXML.Alignment() { WrapText = false }; cfs.Append(cf); // index 2 cf = new MSOpenXML.CellFormat(); cf.NumberFormatId = nf4decimal.NumberFormatId; cf.FontId = 0; cf.BorderId = 0; cf.FormatId = 0; cf.ApplyNumberFormat = true; cf.Alignment = new MSOpenXML.Alignment() { WrapText = false }; cfs.Append(cf); // index 3 cf = new MSOpenXML.CellFormat(); cf.NumberFormatId = nf2decimal.NumberFormatId; cf.FontId = 0; cf.BorderId = 0; cf.FormatId = 0; cf.ApplyNumberFormat = true; cf.Alignment = new MSOpenXML.Alignment() { WrapText = false }; cfs.Append(cf); // index 4 cf = new MSOpenXML.CellFormat(); cf.NumberFormatId = nfForcedText.NumberFormatId; cf.FontId = 0; cf.BorderId = 0; cf.FormatId = 0; cf.ApplyNumberFormat = true; cf.Alignment = new MSOpenXML.Alignment() { WrapText = false }; cfs.Append(cf); // index 5 // Header text cf = new MSOpenXML.CellFormat(); cf.NumberFormatId = nfForcedText.NumberFormatId; cf.FontId = 1; cf.BorderId = 0; cf.FormatId = 0; cf.Alignment = new MSOpenXML.Alignment() { WrapText = false }; cf.Alignment.Horizontal = MSOpenXML.HorizontalAlignmentValues.Center; cf.ApplyNumberFormat = true; cfs.Append(cf); // index 6 // group text cf = new MSOpenXML.CellFormat(); cf.NumberFormatId = nf2decimal.NumberFormatId; cf.FontId = 1; cf.BorderId = 1; cf.FormatId = 0; cf.ApplyNumberFormat = true; cf.Alignment = new MSOpenXML.Alignment() { WrapText = false }; cfs.Append(cf); // index 7 // Total text, ColumnHeader Text cf = new MSOpenXML.CellFormat(); cf.NumberFormatId = nf2decimal.NumberFormatId; cf.FontId = 1; cf.BorderId = 0; cf.FormatId = 0; cf.ApplyNumberFormat = true; cf.Alignment = new MSOpenXML.Alignment() { WrapText = false }; 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); MSOpenXML.CellStyles css = new MSOpenXML.CellStyles(); MSOpenXML.CellStyle cs = new MSOpenXML.CellStyle(); cs.Name = "Normal"; cs.FormatId = 0; cs.BuiltinId = 0; css.Append(cs); css.Count = (uint)css.ChildElements.Count; ss.Append(css); MSOpenXML.DifferentialFormats dfs = new MSOpenXML.DifferentialFormats(); dfs.Count = 0; ss.Append(dfs); MSOpenXML.TableStyles tss = new MSOpenXML.TableStyles(); tss.Count = 0; //tss.DefaultTableStyle = StringValue.FromString("TableStyleMedium9"); //tss.DefaultPivotStyle = StringValue.FromString("PivotStyleLight16"); ss.Append(tss); return(ss); }
private static Stylesheet GenerateStylesheet() { Stylesheet styleSheet = null; DocumentFormat.OpenXml.Spreadsheet.Fonts fonts = new DocumentFormat.OpenXml.Spreadsheet.Fonts( new Font( // Index 0 - default new FontSize() { Val = 11 }, new FontName() { Val = "Times New Roman" } ), new Font( // Index 1 - header new FontSize() { Val = 12 }, new DocumentFormat.OpenXml.Spreadsheet.Bold() // new DocumentFormat.OpenXml.Spreadsheet.Color() { Rgb = "FFFFFF" } ), new Font( // Index 2 - new FontSize() { Val = 12 }, new FontName() { Val = "Times New Roman" }, new DocumentFormat.OpenXml.Spreadsheet.Bold() ), new Font( // Index 3 new FontSize() { Val = 12 }, new FontName() { Val = "Times New Roman" } // new DocumentFormat.OpenXml.Spreadsheet.Bold() ), new Font( // Index 4 new FontSize() { Val = 14 }, new FontName() { Val = "Times New Roman" }, new DocumentFormat.OpenXml.Spreadsheet.Bold() ) ); 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 = "ff08c0ce" } }) { PatternType = PatternValues.Solid }), // Index 2 - header new Fill(new PatternFill(new ForegroundColor { Rgb = new HexBinaryValue() { Value = "ff97ffdc" } }) { PatternType = PatternValues.Solid }), // Index 3 - top level process new Fill(new PatternFill(new ForegroundColor { Rgb = new HexBinaryValue() { Value = "ffb9ffdc" } }) { PatternType = PatternValues.Solid }), // Index 4 - group level process new Fill(new PatternFill(new ForegroundColor { Rgb = new HexBinaryValue() { Value = "ffdcffb9" } }) { PatternType = PatternValues.Solid }) // Index 5 - process ); Borders borders = new Borders( new DocumentFormat.OpenXml.Spreadsheet.Border(), // index 0 default new DocumentFormat.OpenXml.Spreadsheet.Border( // index 1 black border new LeftBorder(new DocumentFormat.OpenXml.Spreadsheet.Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new RightBorder(new DocumentFormat.OpenXml.Spreadsheet.Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new TopBorder(new DocumentFormat.OpenXml.Spreadsheet.Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new BottomBorder(new DocumentFormat.OpenXml.Spreadsheet.Color() { Auto = true }) { Style = BorderStyleValues.Thin }, new DiagonalBorder()) ); CellFormats cellFormats = new CellFormats( new CellFormat(new Alignment() { Vertical = VerticalAlignmentValues.Center, WrapText = true }), // default new CellFormat { Alignment = new Alignment() { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center, WrapText = true }, FontId = 0, FillId = 0, BorderId = 0, ApplyBorder = true, ApplyAlignment = true }, // body new CellFormat { Alignment = new Alignment() { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center, WrapText = true }, FontId = 2, FillId = 0, BorderId = 1, ApplyFill = true }, new CellFormat { Alignment = new Alignment() { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center, WrapText = true }, FontId = 3, FillId = 0, BorderId = 1, ApplyFill = true }, // 3 new CellFormat { Alignment = new Alignment() { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center, WrapText = true }, FontId = 2, FillId = 0, BorderId = 1, ApplyFill = true }, // 4 new CellFormat { Alignment = new Alignment() { Horizontal = HorizontalAlignmentValues.Right, WrapText = true }, FontId = 0, FillId = 0, BorderId = 0, ApplyFill = true }, //5 new CellFormat { Alignment = new Alignment() { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center, WrapText = true }, FontId = 4, FillId = 0, BorderId = 0, ApplyFill = true }, // 6 new CellFormat { Alignment = new Alignment() { Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center, WrapText = true }, FontId = 3, FillId = 0, BorderId = 0, ApplyFill = true }, // 7 new CellFormat { Alignment = new Alignment() { WrapText = true }, FontId = 0, FillId = 0, BorderId = 0, ApplyFill = true } // process ); styleSheet = new Stylesheet(fonts, fills, borders, cellFormats); return(styleSheet); }