private static void AddDifferentialFormat(DifferentialFormats differentialFormats, IXLConditionalFormat cf,
            SaveContext context)
        {
            var differentialFormat = new DifferentialFormat();
            differentialFormat.Append(GetNewFont(new FontInfo {Font = cf.Style.Font as XLFont}, false));
            if (!XLHelper.IsNullOrWhiteSpace(cf.Style.NumberFormat.Format))
            {
                var numberFormat = new NumberingFormat
                {
                    NumberFormatId = (UInt32)(differentialFormats.Count() + 164),
                    FormatCode = cf.Style.NumberFormat.Format
                };
                differentialFormat.Append(numberFormat);
            }
            differentialFormat.Append(GetNewFill(new FillInfo {Fill = cf.Style.Fill as XLFill}, false));
            differentialFormat.Append(GetNewBorder(new BorderInfo {Border = cf.Style.Border as XLBorder}, false));

            differentialFormats.Append(differentialFormat);

            context.DifferentialFormats.Add(cf.Style, differentialFormats.Count() - 1);
        }
        private DifferentialFormats GetDifferentialFormats()
        {
            DifferentialFormats differentialFormats = new DifferentialFormats();

            differentialFormats.Count = 0;
            return(differentialFormats);
        }
Beispiel #3
0
        private static DifferentialFormats CreateDiffFormats()
        {
            DifferentialFormats dfs = new DifferentialFormats();

            dfs.Count = 0;

            return(dfs);
        }
 /// <summary>
 /// Добавить формат для условного форматирования ячеек.
 /// Возвращает индекс добавленного формата.
 /// </summary>
 /// <param name="formatsList">Объект содержащий форматы данного типа</param>
 /// <param name="format">Новый формат</param>
 /// <returns>Индекс добавленного формата</returns>
 public static uint AddDFormat(this DifferentialFormats formatsList, DifferentialFormat format)
 {
     formatsList.Append(format);
     if (formatsList.Count != null)
     {
         formatsList.Count.Value++;
     }
     return((uint)format.Index());
 }
Beispiel #5
0
        /// <summary>
        /// Creates Stylesheet from collections of border styles, fontstyles, color styles etc...
        /// </summary>        
        public static Stylesheet GetStyleSheet(ExcelType scheme)
        {
            var stylesheet = new Stylesheet();
            var fontCollection = new FontCollection();
            var fillsCollection = new FillsCollection();
            var borderCollection = new BorderCollection();
            var cellStyleFormats = new CellStyleFormats();

            var cellStyle = new CellFormat();
            cellStyle.NumberFormatId = 0;
            cellStyle.FontId = 0;
            cellStyle.FillId = 0;
            cellStyle.BorderId = 0;
            cellStyleFormats.Append(cellStyle);
            cellStyleFormats.Count = UInt32Value.FromUInt32((uint)cellStyleFormats.ChildElements.Count);

            var numberingFormats = new CellContentFormat();

            var cellFormats = new DocumentFormat.OpenXml.Spreadsheet.CellFormats();
            cellFormats.Append(GetStyleSheetScheme(scheme));
            cellFormats.Count = UInt32Value.FromUInt32((uint)cellFormats.ChildElements.Count);

            stylesheet.Append(numberingFormats);
            stylesheet.Append(fontCollection);
            stylesheet.Append(fillsCollection);
            stylesheet.Append(borderCollection);
            stylesheet.Append(cellStyleFormats);
            stylesheet.Append(cellFormats);

            var css = new DocumentFormat.OpenXml.Spreadsheet.CellStyles();
            var 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);

            var dfs = new DifferentialFormats();
            dfs.Count = 0;
            stylesheet.Append(dfs);

            var tss = new TableStyles();
            tss.Count = 0;
            tss.DefaultTableStyle = StringValue.FromString("TableStyleMedium9");
            tss.DefaultPivotStyle = StringValue.FromString("PivotStyleLight16");
            stylesheet.Append(tss);

            return stylesheet;
        }
Beispiel #6
0
        public StyleCellsAndGenerateText(SpreadsheetDocument document, WorkbookPart workBookPart)
        {
            Document           = document;
            WorkBookPart       = workBookPart;
            WorkbookStylesPart = document.WorkbookPart.AddNewPart <WorkbookStylesPart>();
            Stylesheet  stylesheet  = new Stylesheet();
            CellFormats cellFormats = new CellFormats()
            {
                Count = 0U
            };
            Fonts fonts = new Fonts()
            {
                Count = 0U, KnownFonts = true
            };
            Borders borders = new Borders()
            {
                Count = 0U
            };
            Fills fills = new Fills()
            {
                Count = 0U
            };
            NumberingFormats numberingFormats = new NumberingFormats()
            {
                Count = 0U
            };
            DifferentialFormats differentialFormats = new DifferentialFormats()
            {
                Count = 0U
            };

            stylesheet.Append(numberingFormats);
            stylesheet.Append(fonts);
            stylesheet.Append(fills);
            stylesheet.Append(borders);
            stylesheet.Append(cellFormats);
            stylesheet.Append(differentialFormats);
            WorkbookStylesPart.Stylesheet = stylesheet;
            WorkbookStylesPart.Stylesheet.Save();
            GenerateDefaultStyleIndexZeroCellFormat();
        }
        // 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;
        }
Beispiel #8
0
        static void Main(string[] args)
        {
            var workbookClosed = new XLWorkbook();

            var sheet = workbookClosed.Worksheets.Add("Sheet1");
            sheet.Cell(1, 1).Value = 1;
            sheet.Cell(2, 1).Value = -1;

            workbookClosed.SaveAs("closed.xlsx");

            using (SpreadsheetDocument report = SpreadsheetDocument.Open("closed.xlsx", true))
            {
                Workbook workbook = report.WorkbookPart.Workbook;
                WorksheetPart worksheetPart = workbook.WorkbookPart.WorksheetParts.First();

                DifferentialFormats differentialFormats = new DifferentialFormats() { Count = (UInt32Value)2U };

                DifferentialFormat lessThanFormat = new DifferentialFormat();
                Font lessThanFont = new Font();
                lessThanFont.Append(new Condense() { Val = false });
                lessThanFont.Append(new Extend() { Val = false });
                lessThanFont.Append(new Color() { Rgb = "FF9C0006" });
                Fill lessThanFill = new Fill();
                PatternFill lessThanPatternFill = new PatternFill();
                lessThanPatternFill.Append(new BackgroundColor() { Rgb = "FFFFC7CE" });
                lessThanFill.Append(lessThanPatternFill);
                lessThanFormat.Append(lessThanFont);
                lessThanFormat.Append(lessThanFill);

                DifferentialFormat greaterThanFormat = new DifferentialFormat();
                Font greaterThanFont = new Font();
                greaterThanFont.Append(new Condense() { Val = false });
                greaterThanFont.Append(new Extend() { Val = false });
                greaterThanFont.Append(new Color() { Rgb = "FF006100" });
                Fill greatherThanFill = new Fill();
                PatternFill greaterThanPatternFill = new PatternFill();
                greaterThanPatternFill.Append(new BackgroundColor() { Rgb = "FFC6EFCE" });
                greatherThanFill.Append(greaterThanPatternFill);
                greaterThanFormat.Append(greaterThanFont);
                greaterThanFormat.Append(greatherThanFill);

                differentialFormats.Append(lessThanFormat);
                differentialFormats.Append(greaterThanFormat);
                workbook.WorkbookPart.WorkbookStylesPart.Stylesheet.Append(differentialFormats);

                ConditionalFormatting conditionalFormatting = new ConditionalFormatting()
                {
                    SequenceOfReferences = new ListValue<StringValue>() { InnerText = "D2:D10" }
                };

                ConditionalFormattingRule greaterThanRule = new ConditionalFormattingRule()
                {
                    Type = ConditionalFormatValues.CellIs,
                    FormatId = (UInt32Value)1U,
                    Priority = 2,
                    Operator = ConditionalFormattingOperatorValues.GreaterThan
                };
                Formula greaterThanFormula = new Formula();
                greaterThanFormula.Text = "0";
                greaterThanRule.Append(greaterThanFormula);

                ConditionalFormattingRule lessThanRule = new ConditionalFormattingRule()
                {
                    Type = ConditionalFormatValues.CellIs,
                    FormatId = (UInt32Value)0U,
                    Priority = 1,
                    Operator = ConditionalFormattingOperatorValues.LessThan
                };
                Formula lessThanFormula = new Formula();
                lessThanFormula.Text = "0";
                lessThanRule.Append(lessThanFormula);

                conditionalFormatting.Append(greaterThanRule);
                conditionalFormatting.Append(lessThanRule);

                worksheetPart.Worksheet.PrependChild<ConditionalFormatting>(conditionalFormatting);

                report.WorkbookPart.Workbook.Save();
                report.Close();
            }
        }
Beispiel #9
0
        /// <summary>
        /// create the default excel formats.  These formats are required for the excel in order for it to render
        /// correctly.
        /// </summary>
        /// <returns></returns>
        private Stylesheet CreateDefaultStylesheet()
        {
            Stylesheet ss = new Stylesheet();

            Fonts fts = new Fonts();

            DocumentFormat.OpenXml.Spreadsheet.Font ft = new DocumentFormat.OpenXml.Spreadsheet.Font();
            FontName ftn = new FontName();

            ftn.Val = "Calibri";
            FontSize ftsz = new FontSize();

            ftsz.Val    = 11;
            ft.FontName = ftn;
            ft.FontSize = ftsz;
            fts.Append(ft);
            fts.Count = (uint)fts.ChildElements.Count;

            Fills       fills = new Fills();
            Fill        fill;
            PatternFill patternFill;

            //default fills used by Excel, don't changes these

            fill                    = new Fill();
            patternFill             = new PatternFill();
            patternFill.PatternType = PatternValues.None;
            fill.PatternFill        = patternFill;
            fills.AppendChild(fill);

            fill                    = new Fill();
            patternFill             = new PatternFill();
            patternFill.PatternType = PatternValues.Gray125;
            fill.PatternFill        = patternFill;
            fills.AppendChild(fill);



            fills.Count = (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);
            borders.Count = (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 = (uint)csfs.ChildElements.Count;


            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);



            var nfs = new NumberingFormats();



            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);

            CellStyles css = new CellStyles(
                new CellStyle()
            {
                Name      = "Normal",
                FormatId  = 0,
                BuiltinId = 0,
            }
                );

            css.Count = (uint)css.ChildElements.Count;
            ss.Append(css);

            DifferentialFormats dfs = new DifferentialFormats();

            dfs.Count = 0;
            ss.Append(dfs);

            TableStyles tss = new TableStyles();

            tss.Count             = 0;
            tss.DefaultTableStyle = "TableStyleMedium9";
            tss.DefaultPivotStyle = "PivotStyleLight16";
            ss.Append(tss);
            return(ss);
        }
Beispiel #10
0
 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);
 }
 private void FillDifferentialFormatsCollection(DifferentialFormats differentialFormats,
     Dictionary<IXLStyle, int> dictionary)
 {
     dictionary.Clear();
     var id = 0;
     foreach (var df in differentialFormats.Elements<DifferentialFormat>())
     {
         var style = new XLStyle(new XLStylizedEmpty(DefaultStyle), DefaultStyle);
         LoadFont(df.Font, style.Font);
         LoadBorder(df.Border, style.Border);
         LoadNumberFormat(df.NumberingFormat, style.NumberFormat);
         LoadFill(df.Fill, style.Fill);
         if (!dictionary.ContainsKey(style))
             dictionary.Add(style, ++id);
     }
 }
Beispiel #12
0
        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);
        }
        /// <summary>
        /// create the default excel formats.  These formats are required for the excel in order for it to render
        /// correctly.
        /// </summary>
        /// <returns></returns>
        public Stylesheet CreateDefaultStylesheet()
        {
            Stylesheet ss = new Stylesheet();
            Fonts fts = new Fonts();
            DocumentFormat.OpenXml.Spreadsheet.Font ft = new DocumentFormat.OpenXml.Spreadsheet.Font();
            FontName ftn = new FontName();
            ftn.Val = "Calibri";
            FontSize ftsz = new FontSize();
            ftsz.Val = 11;
            ft.FontName = ftn;
            ft.FontSize = ftsz;
            fts.Append(ft);
            fts.Count = (uint)fts.ChildElements.Count;

            Fills fills = new Fills();
            Fill fill;
            PatternFill patternFill;

            //default fills used by Excel, don't changes these

            fill = new Fill();
            patternFill = new PatternFill();
            patternFill.PatternType = PatternValues.None;
            fill.PatternFill = patternFill;
            fills.AppendChild(fill);

            fill = new Fill();
            patternFill = new PatternFill();
            patternFill.PatternType = PatternValues.Gray125;
            fill.PatternFill = patternFill;
            fills.AppendChild(fill);

            fills.Count = (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);
            borders.Count = (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 = (uint)csfs.ChildElements.Count;

            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);

            var nfs = new NumberingFormats();

            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);

            CellStyles css = new CellStyles(
                new CellStyle()
                {
                    Name = "Normal",
                    FormatId = 0,
                    BuiltinId = 0,
                }
                );

            css.Count = (uint)css.ChildElements.Count;
            ss.Append(css);

            DifferentialFormats dfs = new DifferentialFormats();
            dfs.Count = 0;
            ss.Append(dfs);

            TableStyles tss = new TableStyles();
            tss.Count = 0;
            tss.DefaultTableStyle = "TableStyleMedium9";
            tss.DefaultPivotStyle = "PivotStyleLight16";
            ss.Append(tss);
            return ss;
        }
        // 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)5U, KnownFonts = true };

            Font font1 = new Font();
            FontSize fontSize3 = new FontSize() { Val = 11D };
            Color color3 = new Color() { Theme = (UInt32Value)1U };
            FontName fontName1 = new FontName() { Val = "Calibri" };
            FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 };
            FontScheme fontScheme2 = new FontScheme() { Val = FontSchemeValues.Minor };

            font1.Append(fontSize3);
            font1.Append(color3);
            font1.Append(fontName1);
            font1.Append(fontFamilyNumbering1);
            font1.Append(fontScheme2);

            Font font2 = new Font();
            Bold bold2 = new Bold();
            Underline underline1 = new Underline();
            FontSize fontSize4 = new FontSize() { Val = 11D };
            Color color4 = new Color() { Rgb = "FFFF0000" };
            FontName fontName2 = new FontName() { Val = "Calibri" };
            FontFamilyNumbering fontFamilyNumbering2 = new FontFamilyNumbering() { Val = 2 };
            FontScheme fontScheme3 = new FontScheme() { Val = FontSchemeValues.Minor };

            font2.Append(bold2);
            font2.Append(underline1);
            font2.Append(fontSize4);
            font2.Append(color4);
            font2.Append(fontName2);
            font2.Append(fontFamilyNumbering2);
            font2.Append(fontScheme3);

            Font font3 = new Font();
            Underline underline2 = new Underline();
            FontSize fontSize5 = new FontSize() { Val = 11D };
            Color color5 = new Color() { Theme = (UInt32Value)10U };
            FontName fontName3 = new FontName() { Val = "Calibri" };
            FontFamilyNumbering fontFamilyNumbering3 = new FontFamilyNumbering() { Val = 2 };
            FontScheme fontScheme4 = new FontScheme() { Val = FontSchemeValues.Minor };

            font3.Append(underline2);
            font3.Append(fontSize5);
            font3.Append(color5);
            font3.Append(fontName3);
            font3.Append(fontFamilyNumbering3);
            font3.Append(fontScheme4);

            Font font4 = new Font();
            FontSize fontSize6 = new FontSize() { Val = 9D };
            Color color6 = new Color() { Indexed = (UInt32Value)81U };
            FontName fontName4 = new FontName() { Val = "Tahoma" };
            FontCharSet fontCharSet1 = new FontCharSet() { Val = 1 };

            font4.Append(fontSize6);
            font4.Append(color6);
            font4.Append(fontName4);
            font4.Append(fontCharSet1);

            Font font5 = new Font();
            Bold bold3 = new Bold();
            FontSize fontSize7 = new FontSize() { Val = 9D };
            Color color7 = new Color() { Indexed = (UInt32Value)81U };
            FontName fontName5 = new FontName() { Val = "Tahoma" };
            FontCharSet fontCharSet2 = new FontCharSet() { Val = 1 };

            font5.Append(bold3);
            font5.Append(fontSize7);
            font5.Append(color7);
            font5.Append(fontName5);
            font5.Append(fontCharSet2);

            fonts1.Append(font1);
            fonts1.Append(font2);
            fonts1.Append(font3);
            fonts1.Append(font4);
            fonts1.Append(font5);

            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)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)2U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, ApplyNumberFormat = false, ApplyFill = false, ApplyBorder = false, ApplyAlignment = false, ApplyProtection = false };

            cellStyleFormats1.Append(cellFormat1);
            cellStyleFormats1.Append(cellFormat2);

            CellFormats cellFormats1 = new CellFormats() { Count = (UInt32Value)4U };
            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)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true };

            CellFormat cellFormat5 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyAlignment = true };
            Alignment alignment1 = new Alignment() { WrapText = true };

            cellFormat5.Append(alignment1);
            CellFormat cellFormat6 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U };

            cellFormats1.Append(cellFormat3);
            cellFormats1.Append(cellFormat4);
            cellFormats1.Append(cellFormat5);
            cellFormats1.Append(cellFormat6);

            CellStyles cellStyles1 = new CellStyles() { Count = (UInt32Value)2U };
            CellStyle cellStyle1 = new CellStyle() { Name = "Hyperlink", FormatId = (UInt32Value)1U, BuiltinId = (UInt32Value)8U };
            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 = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleMedium9" };

            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;
        }
        // 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");

            NumberingFormats numberingFormats1 = new NumberingFormats(){ Count = (UInt32Value)1U };
            NumberingFormat numberingFormat11 = new NumberingFormat(){ NumberFormatId = (UInt32Value)164U, FormatCode = "\"¥\"#,##0" };

            numberingFormats1.Append(numberingFormat11);

            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 };
            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 = 6D };
            FontName fontName2 = new FontName(){ Val = "Calibri" };
            FontFamilyNumbering fontFamilyNumbering2 = new FontFamilyNumbering(){ Val = 3 };
            FontCharSet fontCharSet1 = new FontCharSet(){ Val = 128 };
            FontScheme fontScheme2 = new FontScheme(){ Val = FontSchemeValues.Minor };

            font2.Append(fontSize2);
            font2.Append(fontName2);
            font2.Append(fontFamilyNumbering2);
            font2.Append(fontCharSet1);
            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 };

            cellStyleFormats1.Append(cellFormat1);

            CellFormats cellFormats1 = new CellFormats(){ Count = (UInt32Value)8U };
            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, ApplyAlignment = true };
            Alignment alignment1 = new Alignment(){ Vertical = VerticalAlignmentValues.Center };

            cellFormat3.Append(alignment1);

            CellFormat cellFormat4 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyAlignment = true };
            Alignment alignment2 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center };

            cellFormat4.Append(alignment2);

            CellFormat cellFormat5 = new CellFormat(){ NumberFormatId = (UInt32Value)14U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyAlignment = true };
            Alignment alignment3 = new Alignment(){ Vertical = VerticalAlignmentValues.Center };

            cellFormat5.Append(alignment3);

            CellFormat cellFormat6 = new CellFormat(){ NumberFormatId = (UInt32Value)164U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyAlignment = true };
            Alignment alignment4 = new Alignment(){ Vertical = VerticalAlignmentValues.Center };

            cellFormat6.Append(alignment4);
            CellFormat cellFormat7 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, PivotButton = true };

            CellFormat cellFormat8 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyAlignment = true };
            Alignment alignment5 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Left };

            cellFormat8.Append(alignment5);
            CellFormat cellFormat9 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true };

            cellFormats1.Append(cellFormat2);
            cellFormats1.Append(cellFormat3);
            cellFormats1.Append(cellFormat4);
            cellFormats1.Append(cellFormat5);
            cellFormats1.Append(cellFormat6);
            cellFormats1.Append(cellFormat7);
            cellFormats1.Append(cellFormat8);
            cellFormats1.Append(cellFormat9);

            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)14U };

            DifferentialFormat differentialFormat1 = new DifferentialFormat();
            Alignment alignment6 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center, TextRotation = (UInt32Value)0U, WrapText = false, Indent = (UInt32Value)0U, JustifyLastLine = false, ShrinkToFit = false, ReadingOrder = (UInt32Value)0U };

            differentialFormat1.Append(alignment6);

            DifferentialFormat differentialFormat2 = new DifferentialFormat();
            NumberingFormat numberingFormat12 = new NumberingFormat(){ NumberFormatId = (UInt32Value)164U, FormatCode = "\"¥\"#,##0" };

            differentialFormat2.Append(numberingFormat12);

            DifferentialFormat differentialFormat3 = new DifferentialFormat();
            Alignment alignment7 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center, TextRotation = (UInt32Value)0U, WrapText = false, Indent = (UInt32Value)0U, JustifyLastLine = false, ShrinkToFit = false, ReadingOrder = (UInt32Value)0U };

            differentialFormat3.Append(alignment7);

            DifferentialFormat differentialFormat4 = new DifferentialFormat();
            NumberingFormat numberingFormat13 = new NumberingFormat(){ NumberFormatId = (UInt32Value)0U, FormatCode = "General" };

            differentialFormat4.Append(numberingFormat13);

            DifferentialFormat differentialFormat5 = new DifferentialFormat();
            NumberingFormat numberingFormat14 = new NumberingFormat(){ NumberFormatId = (UInt32Value)165U, FormatCode = "yyyy/mm/dd" };

            differentialFormat5.Append(numberingFormat14);

            DifferentialFormat differentialFormat6 = new DifferentialFormat();
            NumberingFormat numberingFormat15 = new NumberingFormat(){ NumberFormatId = (UInt32Value)0U, FormatCode = "General" };

            differentialFormat6.Append(numberingFormat15);

            DifferentialFormat differentialFormat7 = new DifferentialFormat();
            NumberingFormat numberingFormat16 = new NumberingFormat(){ NumberFormatId = (UInt32Value)0U, FormatCode = "General" };

            differentialFormat7.Append(numberingFormat16);

            DifferentialFormat differentialFormat8 = new DifferentialFormat();
            NumberingFormat numberingFormat17 = new NumberingFormat(){ NumberFormatId = (UInt32Value)0U, FormatCode = "General" };

            differentialFormat8.Append(numberingFormat17);

            DifferentialFormat differentialFormat9 = new DifferentialFormat();
            NumberingFormat numberingFormat18 = new NumberingFormat(){ NumberFormatId = (UInt32Value)165U, FormatCode = "yyyy/mm/dd" };

            differentialFormat9.Append(numberingFormat18);

            DifferentialFormat differentialFormat10 = new DifferentialFormat();
            Alignment alignment8 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center, TextRotation = (UInt32Value)0U, WrapText = false, Indent = (UInt32Value)0U, JustifyLastLine = false, ShrinkToFit = false, ReadingOrder = (UInt32Value)0U };

            differentialFormat10.Append(alignment8);

            DifferentialFormat differentialFormat11 = new DifferentialFormat();
            NumberingFormat numberingFormat19 = new NumberingFormat(){ NumberFormatId = (UInt32Value)164U, FormatCode = "\"¥\"#,##0" };

            differentialFormat11.Append(numberingFormat19);

            DifferentialFormat differentialFormat12 = new DifferentialFormat();
            Alignment alignment9 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center, TextRotation = (UInt32Value)0U, WrapText = false, Indent = (UInt32Value)0U, JustifyLastLine = false, ShrinkToFit = false, ReadingOrder = (UInt32Value)0U };

            differentialFormat12.Append(alignment9);

            DifferentialFormat differentialFormat13 = new DifferentialFormat();
            NumberingFormat numberingFormat20 = new NumberingFormat(){ NumberFormatId = (UInt32Value)165U, FormatCode = "yyyy/mm/dd" };

            differentialFormat13.Append(numberingFormat20);

            DifferentialFormat differentialFormat14 = new DifferentialFormat();
            NumberingFormat numberingFormat21 = new NumberingFormat(){ NumberFormatId = (UInt32Value)165U, FormatCode = "yyyy/mm/dd" };

            differentialFormat14.Append(numberingFormat21);

            differentialFormats1.Append(differentialFormat1);
            differentialFormats1.Append(differentialFormat2);
            differentialFormats1.Append(differentialFormat3);
            differentialFormats1.Append(differentialFormat4);
            differentialFormats1.Append(differentialFormat5);
            differentialFormats1.Append(differentialFormat6);
            differentialFormats1.Append(differentialFormat7);
            differentialFormats1.Append(differentialFormat8);
            differentialFormats1.Append(differentialFormat9);
            differentialFormats1.Append(differentialFormat10);
            differentialFormats1.Append(differentialFormat11);
            differentialFormats1.Append(differentialFormat12);
            differentialFormats1.Append(differentialFormat13);
            differentialFormats1.Append(differentialFormat14);
            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(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(stylesheetExtensionList1);

            workbookStylesPart1.Stylesheet = stylesheet1;
        }
        // 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 = 162 };
            FontScheme fontScheme2 = new FontScheme(){ Val = FontSchemeValues.Minor };

            font1.Append(fontSize1);
            font1.Append(color1);
            font1.Append(fontName1);
            font1.Append(fontFamilyNumbering1);
            font1.Append(fontCharSet1);
            font1.Append(fontScheme2);

            Font font2 = new Font();
            FontSize fontSize2 = new FontSize(){ Val = 6D };
            FontName fontName2 = new FontName(){ Val = "Calibri" };
            FontFamilyNumbering fontFamilyNumbering2 = new FontFamilyNumbering(){ Val = 3 };
            FontCharSet fontCharSet2 = new FontCharSet(){ Val = 128 };
            FontScheme fontScheme3 = new FontScheme(){ Val = FontSchemeValues.Minor };

            font2.Append(fontSize2);
            font2.Append(fontName2);
            font2.Append(fontFamilyNumbering2);
            font2.Append(fontCharSet2);
            font2.Append(fontScheme3);

            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)10U };

            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 color2 = new Color(){ Indexed = (UInt32Value)8U };

            leftBorder2.Append(color2);
            RightBorder rightBorder2 = new RightBorder();

            TopBorder topBorder2 = new TopBorder(){ Style = BorderStyleValues.Thin };
            Color color3 = new Color(){ Indexed = (UInt32Value)8U };

            topBorder2.Append(color3);
            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 color4 = new Color(){ Indexed = (UInt32Value)65U };

            leftBorder3.Append(color4);
            RightBorder rightBorder3 = new RightBorder();

            TopBorder topBorder3 = new TopBorder(){ Style = BorderStyleValues.Thin };
            Color color5 = new Color(){ Indexed = (UInt32Value)8U };

            topBorder3.Append(color5);
            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 color6 = new Color(){ Indexed = (UInt32Value)65U };

            leftBorder4.Append(color6);

            RightBorder rightBorder4 = new RightBorder(){ Style = BorderStyleValues.Thin };
            Color color7 = new Color(){ Indexed = (UInt32Value)8U };

            rightBorder4.Append(color7);

            TopBorder topBorder4 = new TopBorder(){ Style = BorderStyleValues.Thin };
            Color color8 = new Color(){ Indexed = (UInt32Value)8U };

            topBorder4.Append(color8);
            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(){ Style = BorderStyleValues.Thin };
            Color color9 = new Color(){ Indexed = (UInt32Value)8U };

            leftBorder5.Append(color9);
            RightBorder rightBorder5 = new RightBorder();

            TopBorder topBorder5 = new TopBorder(){ Style = BorderStyleValues.Thin };
            Color color10 = new Color(){ Indexed = (UInt32Value)65U };

            topBorder5.Append(color10);
            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 color11 = new Color(){ Indexed = (UInt32Value)65U };

            leftBorder6.Append(color11);
            RightBorder rightBorder6 = new RightBorder();

            TopBorder topBorder6 = new TopBorder(){ Style = BorderStyleValues.Thin };
            Color color12 = new Color(){ Indexed = (UInt32Value)65U };

            topBorder6.Append(color12);
            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 color13 = new Color(){ Indexed = (UInt32Value)65U };

            leftBorder7.Append(color13);

            RightBorder rightBorder7 = new RightBorder(){ Style = BorderStyleValues.Thin };
            Color color14 = new Color(){ Indexed = (UInt32Value)8U };

            rightBorder7.Append(color14);

            TopBorder topBorder7 = new TopBorder(){ Style = BorderStyleValues.Thin };
            Color color15 = new Color(){ Indexed = (UInt32Value)65U };

            topBorder7.Append(color15);
            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 color16 = new Color(){ Indexed = (UInt32Value)8U };

            leftBorder8.Append(color16);
            RightBorder rightBorder8 = new RightBorder();

            TopBorder topBorder8 = new TopBorder(){ Style = BorderStyleValues.Thin };
            Color color17 = new Color(){ Indexed = (UInt32Value)65U };

            topBorder8.Append(color17);

            BottomBorder bottomBorder8 = new BottomBorder(){ Style = BorderStyleValues.Thin };
            Color color18 = new Color(){ Indexed = (UInt32Value)8U };

            bottomBorder8.Append(color18);
            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 color19 = new Color(){ Indexed = (UInt32Value)65U };

            leftBorder9.Append(color19);
            RightBorder rightBorder9 = new RightBorder();

            TopBorder topBorder9 = new TopBorder(){ Style = BorderStyleValues.Thin };
            Color color20 = new Color(){ Indexed = (UInt32Value)65U };

            topBorder9.Append(color20);

            BottomBorder bottomBorder9 = new BottomBorder(){ Style = BorderStyleValues.Thin };
            Color color21 = new Color(){ Indexed = (UInt32Value)8U };

            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)65U };

            leftBorder10.Append(color22);

            RightBorder rightBorder10 = new RightBorder(){ Style = BorderStyleValues.Thin };
            Color color23 = new Color(){ Indexed = (UInt32Value)8U };

            rightBorder10.Append(color23);

            TopBorder topBorder10 = new TopBorder(){ Style = BorderStyleValues.Thin };
            Color color24 = new Color(){ Indexed = (UInt32Value)65U };

            topBorder10.Append(color24);

            BottomBorder bottomBorder10 = new BottomBorder(){ Style = BorderStyleValues.Thin };
            Color color25 = new Color(){ Indexed = (UInt32Value)8U };

            bottomBorder10.Append(color25);
            DiagonalBorder diagonalBorder10 = new DiagonalBorder();

            border10.Append(leftBorder10);
            border10.Append(rightBorder10);
            border10.Append(topBorder10);
            border10.Append(bottomBorder10);
            border10.Append(diagonalBorder10);

            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);

            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)11U };
            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 };
            CellFormat cellFormat4 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyBorder = true };
            CellFormat cellFormat5 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyBorder = true };
            CellFormat cellFormat6 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)3U, FormatId = (UInt32Value)0U, ApplyBorder = true };
            CellFormat cellFormat7 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)4U, FormatId = (UInt32Value)0U, ApplyBorder = true };
            CellFormat cellFormat8 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)5U, FormatId = (UInt32Value)0U, ApplyBorder = true };
            CellFormat cellFormat9 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)6U, FormatId = (UInt32Value)0U, ApplyBorder = true };
            CellFormat cellFormat10 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)7U, FormatId = (UInt32Value)0U, ApplyBorder = true };
            CellFormat cellFormat11 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)8U, FormatId = (UInt32Value)0U, ApplyBorder = true };
            CellFormat cellFormat12 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)9U, FormatId = (UInt32Value)0U, ApplyBorder = true };

            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);

            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();
            NumberingFormat numberingFormat1 = new NumberingFormat(){ NumberFormatId = (UInt32Value)164U, FormatCode = "dd/mm/yyyy" };

            differentialFormat1.Append(numberingFormat1);

            differentialFormats1.Append(differentialFormat1);
            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;
        }
        // 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);
        }
Beispiel #18
0
        public static Stylesheet CreateStylesheet()
        {
            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");

            var fonts1   = AddFonts();
            var fills1   = AddFills();
            var borders1 = AddBorders();

            CellStyleFormats cellStyleFormats1 = new CellStyleFormats()
            {
                Count = 1U
            };
            CellFormat cellFormat1 = new CellFormat()
            {
                NumberFormatId = 0U, FontId = 0U, FillId = 0U, BorderId = 0U
            };

            cellStyleFormats1.AppendChild(cellFormat1);

            CellFormats cellFormats1 = new CellFormats()
            {
                Count = 4U
            };
            // Black text on White background
            CellFormat cellFormat2 = new CellFormat()
            {
                NumberFormatId = 0U, FontId = 0U, FillId = 0U, BorderId = 0U, FormatId = 0U
            };
            // White text on Orange background
            CellFormat cellFormat3 = new CellFormat()
            {
                NumberFormatId = 0U, FontId = 1U, FillId = 2U, BorderId = 0U, FormatId = 0U, ApplyFill = true
            };
            // White text on Blue background
            CellFormat cellFormat4 = new CellFormat()
            {
                NumberFormatId = 0U, FontId = 1U, FillId = 3U, BorderId = 0U, FormatId = 0U, ApplyFill = true
            };
            // Black text on Yellow background
            CellFormat cellFormat5 = new CellFormat()
            {
                NumberFormatId = 0U, FontId = 0U, FillId = 4U, BorderId = 0U, FormatId = 0U, ApplyFill = true
            };

            cellFormats1.AppendChild(cellFormat2);
            cellFormats1.AppendChild(cellFormat3);
            cellFormats1.AppendChild(cellFormat4);
            cellFormats1.AppendChild(cellFormat5);

            CellStyles cellStyles1 = new CellStyles()
            {
                Count = 1U
            };
            CellStyle cellStyle1 = new CellStyle()
            {
                Name = "Normal", FormatId = 0U, BuiltinId = 0U
            };

            cellStyles1.AppendChild(cellStyle1);
            DifferentialFormats differentialFormats1 = new DifferentialFormats()
            {
                Count = 0U
            };
            TableStyles tableStyles1 = new TableStyles()
            {
                Count = 0U, DefaultTableStyle = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleMedium9"
            };

            StylesheetExtensionList stylesheetExtensionList = new StylesheetExtensionList();
            StylesheetExtension     stylesheetExtension     = new StylesheetExtension()
            {
                Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}"
            };

            stylesheetExtension.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
            DocumentFormat.OpenXml.Office2010.Excel.SlicerStyles slicerStyles = new DocumentFormat.OpenXml.Office2010.Excel.SlicerStyles()
            {
                DefaultSlicerStyle = "SlicerStyleLight1"
            };
            stylesheetExtension.AppendChild(slicerStyles);
            stylesheetExtensionList.AppendChild(stylesheetExtension);


            stylesheet1.AppendChild(fonts1);
            stylesheet1.AppendChild(fills1);
            stylesheet1.AppendChild(borders1);
            stylesheet1.AppendChild(cellStyleFormats1);
            stylesheet1.AppendChild(cellFormats1);
            stylesheet1.AppendChild(cellStyles1);
            stylesheet1.AppendChild(differentialFormats1);
            stylesheet1.AppendChild(tableStyles1);
            stylesheet1.AppendChild(stylesheetExtensionList);
            return(stylesheet1);
        }
        // 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;
        }
Beispiel #20
0
        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);
        }
Beispiel #21
0
            // 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;
        }
Beispiel #23
0
        public Stylesheet CreateStylesheet()
        {
            Stylesheet ss = new Stylesheet();

            Fonts fts = new Fonts();

            Font ft = new Font()
            {
                FontName = new FontName()
                {
                    Val = StringValue.FromString("Arial")
                },
                FontSize = new FontSize()
                {
                    Val = DoubleValue.FromDouble(8)
                }
            };

            fts.Append(ft);

            ft = new Font()
            {
                FontName = new FontName()
                {
                    Val = StringValue.FromString("Arial")
                },
                FontSize = new FontSize()
                {
                    Val = DoubleValue.FromDouble(18)
                }
            };
            fts.Append(ft);

            ft = new Font()
            {
                FontName = new FontName()
                {
                    Val = StringValue.FromString("Arial")
                },
                FontSize = new FontSize()
                {
                    Val = DoubleValue.FromDouble(9)
                },
                Bold = new Bold()
            };//new Bold() { Val = new BooleanValue(true) }
            fts.Append(ft);

            ft = new Font()
            {
                FontName = new FontName()
                {
                    Val = StringValue.FromString("Arial")
                },
                FontSize = new FontSize()
                {
                    Val = DoubleValue.FromDouble(14)
                }
            };
            fts.Append(ft);

            fts.Count = UInt32Value.FromUInt32((uint)fts.ChildElements.Count);

            Fills fills = new Fills();
            Fill  fill  = new Fill()
            {
                PatternFill = new PatternFill()
                {
                    PatternType = PatternValues.None
                }
            };

            fills.Append(fill);

            fill = new Fill()
            {
                PatternFill = new PatternFill()
                {
                    PatternType = PatternValues.Gray125
                }
            };
            fills.Append(fill);

            fill = new Fill()
            {
                PatternFill = new PatternFill()
                {
                    PatternType     = PatternValues.Solid,
                    ForegroundColor = new ForegroundColor()
                    {
                        Rgb = HexBinaryValue.FromString("00d3d3d3")
                    },
                    BackgroundColor = new BackgroundColor()
                    {
                        Rgb = HexBinaryValue.FromString("00d3d3d3")
                    }
                }
            };
            fills.Append(fill);

            fills.Count = UInt32Value.FromUInt32((uint)fills.ChildElements.Count);

            Borders borders = new Borders();
            Border  border  = new Border()
            {
                LeftBorder     = new LeftBorder(),
                RightBorder    = new RightBorder(),
                TopBorder      = new TopBorder(),
                BottomBorder   = new BottomBorder(),
                DiagonalBorder = new DiagonalBorder()
            };

            borders.Append(border);

            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);

            border = new Border()
            {
                LeftBorder = new LeftBorder()
                {
                    Style = BorderStyleValues.Thick
                },
                RightBorder = new RightBorder()
                {
                    Style = BorderStyleValues.Thick
                },
                TopBorder = new TopBorder()
                {
                    Style = BorderStyleValues.Thick
                },
                BottomBorder = new BottomBorder()
                {
                    Style = BorderStyleValues.Thick
                },
                DiagonalBorder = new DiagonalBorder()
            };
            borders.Append(border);

            border = new Border()
            {
                LeftBorder  = new LeftBorder(),
                RightBorder = new RightBorder(),
                TopBorder   = new TopBorder()
                {
                    Style = BorderStyleValues.Double
                },
                BottomBorder   = new BottomBorder(),
                DiagonalBorder = new DiagonalBorder()
            };
            borders.Append(border);

            borders.Count = UInt32Value.FromUInt32((uint)borders.ChildElements.Count);

            CellStyleFormats csfs = new CellStyleFormats();
            CellFormat       cf   = new CellFormat()
            {
                NumberFormatId = 0, FontId = 0, FillId = 0, 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()
            {
                NumberFormatId = 0, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0
            };
            cfs.Append(cf);

            NumberingFormat nfDateTime = new NumberingFormat()
            {
                NumberFormatId = UInt32Value.FromUInt32(iExcelIndex++),
                FormatCode     = StringValue.FromString("dd/mm/yyyy hh:mm:ss")
            };

            nfs.Append(nfDateTime);

            NumberingFormat nf4decimal = new NumberingFormat()
            {
                NumberFormatId = UInt32Value.FromUInt32(iExcelIndex++),
                FormatCode     = StringValue.FromString("#,##0.00")
            };

            nfs.Append(nf4decimal);

            // #,##0.00 is also Excel style index 4
            NumberingFormat nf2decimal = new NumberingFormat()
            {
                NumberFormatId = UInt32Value.FromUInt32(iExcelIndex++),
                FormatCode     = StringValue.FromString("#,##0.00")
            };

            nfs.Append(nf2decimal);

            // @ is also Excel style index 49
            NumberingFormat nfForcedText = new NumberingFormat()
            {
                NumberFormatId = UInt32Value.FromUInt32(iExcelIndex++),
                FormatCode     = StringValue.FromString("@")
            };

            nfs.Append(nfForcedText);

            // index 1
            cf = new CellFormat()
            {
                NumberFormatId = nfDateTime.NumberFormatId, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cfs.Append(cf);

            // index 2
            cf = new CellFormat()
            {
                NumberFormatId = nf2decimal.NumberFormatId, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cfs.Append(cf);

            // index 3
            cf = new CellFormat()
            {
                NumberFormatId = nf2decimal.NumberFormatId, FontId = 0, FillId = 0, BorderId = 1, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cfs.Append(cf);

            // index 4
            cf = new CellFormat()
            {
                NumberFormatId = nfForcedText.NumberFormatId, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cfs.Append(cf);

            // index 5 Header text
            cf = new CellFormat()
            {
                NumberFormatId = nfForcedText.NumberFormatId, FontId = 1, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cfs.Append(cf);

            // index 6 column text
            cf = new CellFormat()
            {
                NumberFormatId = nfForcedText.NumberFormatId, FontId = 0, FillId = 0, BorderId = 1, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cf.Alignment = new Alignment()
            {
                Vertical = new EnumValue <VerticalAlignmentValues>(VerticalAlignmentValues.Center)
            };
            cfs.Append(cf);

            // index 7 coloured 2 decimal text
            cf = new CellFormat()
            {
                NumberFormatId = nf2decimal.NumberFormatId, FontId = 0, FillId = 2, BorderId = 1, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cfs.Append(cf);

            // index 8 coloured column text
            cf = new CellFormat()
            {
                NumberFormatId = nfForcedText.NumberFormatId, FontId = 0, FillId = 2, BorderId = 1, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cfs.Append(cf);

            // index 9
            cf = new CellFormat()
            {
                NumberFormatId = nf2decimal.NumberFormatId, FontId = 2, FillId = 0, BorderId = 1, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cfs.Append(cf);

            // index 10
            cf = new CellFormat()
            {
                NumberFormatId = nf2decimal.NumberFormatId, FontId = 2, FillId = 2, BorderId = 1, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cf.Alignment = new Alignment()
            {
                Vertical = VerticalAlignmentValues.Center, Horizontal = HorizontalAlignmentValues.Center
            };
            cfs.Append(cf);

            // index 11
            cf = new CellFormat()
            {
                NumberFormatId = nf2decimal.NumberFormatId, FontId = 2, FillId = 0, BorderId = 3, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cfs.Append(cf);

            // index 12
            cf = new CellFormat()
            {
                NumberFormatId = nf2decimal.NumberFormatId, FontId = 2, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cfs.Append(cf);

            // index 13
            cf = new CellFormat()
            {
                NumberFormatId = nf2decimal.NumberFormatId, FontId = 3, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cfs.Append(cf);

            nfs.Count = UInt32Value.FromUInt32((uint)nfs.ChildElements.Count);
            cfs.Count = UInt32Value.FromUInt32((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();

            DocumentFormat.OpenXml.Spreadsheet.CellStyle cs = new DocumentFormat.OpenXml.Spreadsheet.CellStyle()
            {
                Name = StringValue.FromString("Normal"), FormatId = 0, BuiltinId = 0
            };
            css.Append(cs);
            css.Count = UInt32Value.FromUInt32((uint)css.ChildElements.Count);
            ss.Append(css);

            var dfs = new DifferentialFormats {
                Count = 0
            };

            ss.Append(dfs);

            TableStyles tss = new TableStyles()
            {
                Count = 0, DefaultTableStyle = StringValue.FromString("TableStyleMedium9"), DefaultPivotStyle = StringValue.FromString("PivotStyleLight16")
            };

            ss.Append(tss);

            return(ss);
        }
Beispiel #24
0
        public static Stylesheet CreateStylesheet()
        {
            Stylesheet ss = new Stylesheet();

            //Font 0, de base
            Fonts fts = new Fonts();

            Font     ft  = new Font();
            FontName ftn = new FontName();

            ftn.Val = "Calibri";
            FontSize ftsz = new FontSize();

            ftsz.Val    = 11;
            ft.FontName = ftn;
            ft.FontSize = ftsz;
            fts.Append(ft);

            fts.Count = (uint)fts.ChildElements.Count;

            //Pour les couleurs de fond des cellules
            Fills fills = new Fills();

            Fill        fill;
            PatternFill patternFill;

            //fill 0, de base, necessaire
            fill                    = new Fill();
            patternFill             = new PatternFill();
            patternFill.PatternType = PatternValues.None;
            fill.PatternFill        = patternFill;
            fills.Append(fill);

            ////fill 1 de base, necessaire
            fill                    = new Fill();
            patternFill             = new PatternFill();
            patternFill.PatternType = PatternValues.Gray125;
            fill.PatternFill        = patternFill;
            fills.Append(fill);


            fills.Count = (uint)fills.ChildElements.Count;

            //Border 0, de base, necessaire
            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);

            borders.Count = (uint)borders.ChildElements.Count;

            //164 : nbre de cellFormat implémenté dans excel, on ajoute donc les notres à la suite
            NumberingFormats nfs = new NumberingFormats();
            CellFormats      cfs = new CellFormats();

            //Cell par défault, semble ne pas compter dans l'index. Particulierement necessaire
            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 = (uint)csfs.ChildElements.Count;

            //CellFormat 0, Necessaire !
            cf = new CellFormat();
            cf.NumberFormatId = 0;
            cf.FontId         = 0;
            cf.FillId         = 0;
            cf.BorderId       = 0;
            cf.FormatId       = 0;
            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);

            //A priori inutil mais a garder, peut être necessaire par la suite
            CellStyles css = new CellStyles();
            CellStyle  cs  = new CellStyle();

            cs.Name      = "Normal";
            cs.FormatId  = 0;
            cs.BuiltinId = 0;
            css.Append(cs);
            css.Count = (uint)css.ChildElements.Count;
            ss.Append(css);

            DifferentialFormats dfs = new DifferentialFormats();

            dfs.Count = 0;
            ss.Append(dfs);

            TableStyles tss = new TableStyles();

            tss.Count             = 0;
            tss.DefaultTableStyle = "TableStyleMedium9";
            tss.DefaultPivotStyle = "PivotStyleLight16";
            ss.Append(tss);

            return(ss);
        }
        public static Stylesheet GenerateStylesheet2()
        {
            Stylesheet ss = new Stylesheet();

            Fonts fts = new Fonts();

            DocumentFormat.OpenXml.Spreadsheet.Font ft = new DocumentFormat.OpenXml.Spreadsheet.Font();
            FontName ftn = new FontName();

            ftn.Val = "Calibri";
            FontSize ftsz = new FontSize();

            ftsz.Val    = 11;
            ft.FontName = ftn;
            ft.FontSize = ftsz;
            fts.Append(ft);
            fts.Count = (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);
            fills.Count = (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);
            borders.Count = (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 = (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 nf;

            nf = new NumberingFormat();
            nf.NumberFormatId = iExcelIndex++;
            nf.FormatCode     = "dd/mm/yyyy hh:mm:ss";
            nfs.Append(nf);
            cf = new CellFormat();
            cf.NumberFormatId    = nf.NumberFormatId;
            cf.FontId            = 0;
            cf.FillId            = 0;
            cf.BorderId          = 0;
            cf.FormatId          = 0;
            cf.ApplyNumberFormat = true;
            cfs.Append(cf);

            nf = new NumberingFormat();
            nf.NumberFormatId = iExcelIndex++;
            nf.FormatCode     = "#,##0.0000";
            nfs.Append(nf);
            cf = new CellFormat();
            cf.NumberFormatId    = nf.NumberFormatId;
            cf.FontId            = 0;
            cf.FillId            = 0;
            cf.BorderId          = 0;
            cf.FormatId          = 0;
            cf.ApplyNumberFormat = true;
            cfs.Append(cf);

            // #,##0.00 is also Excel style index 4
            nf = new NumberingFormat();
            nf.NumberFormatId = iExcelIndex++;
            nf.FormatCode     = "#,##0.00";
            nfs.Append(nf);
            cf = new CellFormat();
            cf.NumberFormatId    = nf.NumberFormatId;
            cf.FontId            = 0;
            cf.FillId            = 0;
            cf.BorderId          = 0;
            cf.FormatId          = 0;
            cf.ApplyNumberFormat = true;
            cfs.Append(cf);

            // @ is also Excel style index 49
            nf = new NumberingFormat();
            nf.NumberFormatId = iExcelIndex++;
            nf.FormatCode     = "@";
            nfs.Append(nf);
            cf = new CellFormat();
            cf.NumberFormatId    = nf.NumberFormatId;
            cf.FontId            = 0;
            cf.FillId            = 0;
            cf.BorderId          = 0;
            cf.FormatId          = 0;
            cf.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);

            CellStyles css = new CellStyles();
            CellStyle  cs  = new CellStyle();

            cs.Name      = "Normal";
            cs.FormatId  = 0;
            cs.BuiltinId = 0;
            css.Append(cs);
            css.Count = (uint)css.ChildElements.Count;
            ss.Append(css);

            DifferentialFormats dfs = new DifferentialFormats();

            dfs.Count = 0;
            ss.Append(dfs);

            TableStyles tss = new TableStyles();

            tss.Count             = 0;
            tss.DefaultTableStyle = "TableStyleMedium9";
            tss.DefaultPivotStyle = "PivotStyleLight16";
            ss.Append(tss);

            return(ss);
        }
Beispiel #26
0
            private DifferentialFormats GenerateDifferentialFormats()
            {
                DifferentialFormats differentialFormats = new DifferentialFormats();

                return(differentialFormats);
            }
        // 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;
        }
Beispiel #28
0
        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.LightGray);
            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.LightGray);
            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 {
                    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);
            //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);
            //All Boarder Index 2
            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);
            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(){ 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;
        }
Beispiel #30
0
        private static Stylesheet CreateStylesheet()
        {
            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)5U
            };

            // FillId = 0
            Fill        fill1        = new Fill();
            PatternFill patternFill1 = new PatternFill()
            {
                PatternType = PatternValues.None
            };

            fill1.Append(patternFill1);

            // FillId = 1
            Fill        fill2        = new Fill();
            PatternFill patternFill2 = new PatternFill()
            {
                PatternType = PatternValues.Gray125
            };

            fill2.Append(patternFill2);

            // FillId = 2,RED
            Fill        fill3        = new Fill();
            PatternFill patternFill3 = new PatternFill()
            {
                PatternType = PatternValues.Solid
            };
            ForegroundColor foregroundColor1 = new ForegroundColor()
            {
                Rgb = "FFFF0000"
            };
            BackgroundColor backgroundColor1 = new BackgroundColor()
            {
                Indexed = (UInt32Value)64U
            };

            patternFill3.Append(foregroundColor1);
            patternFill3.Append(backgroundColor1);
            fill3.Append(patternFill3);

            // FillId = 3,BLUE
            Fill        fill4        = new Fill();
            PatternFill patternFill4 = new PatternFill()
            {
                PatternType = PatternValues.Solid
            };
            ForegroundColor foregroundColor2 = new ForegroundColor()
            {
                Rgb = "FF0070C0"
            };
            BackgroundColor backgroundColor2 = new BackgroundColor()
            {
                Indexed = (UInt32Value)64U
            };

            patternFill4.Append(foregroundColor2);
            patternFill4.Append(backgroundColor2);
            fill4.Append(patternFill4);

            // FillId = 4,YELLO
            Fill        fill5        = new Fill();
            PatternFill patternFill5 = new PatternFill()
            {
                PatternType = PatternValues.Solid
            };
            ForegroundColor foregroundColor3 = new ForegroundColor()
            {
                Rgb = "FFFFFF00"
            };
            BackgroundColor backgroundColor3 = new BackgroundColor()
            {
                Indexed = (UInt32Value)64U
            };

            patternFill5.Append(foregroundColor3);
            patternFill5.Append(backgroundColor3);
            fill5.Append(patternFill5);

            fills1.Append(fill1);
            fills1.Append(fill2);
            fills1.Append(fill3);
            fills1.Append(fill4);
            fills1.Append(fill5);

            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)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true
            };
            CellFormat cellFormat4 = new CellFormat()
            {
                NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true
            };
            CellFormat cellFormat5 = new CellFormat()
            {
                NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)4U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = 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
            };
            TableStyles tableStyles1 = new TableStyles()
            {
                Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleMedium9"
            };

            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");

            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);
        }
        static Stylesheet CreateStylesheet()
        {
            Stylesheet ss = new Stylesheet();

            #region fts (fonts)
            Fonts    fts = new Fonts();
            var      ft  = new DocumentFormat.OpenXml.Spreadsheet.Font();
            FontName ftn = new FontName();
            ftn.Val = StringValue.FromString("Arial");
            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("Verdana");
            ftsz        = new FontSize();
            ftsz.Val    = DoubleValue.FromDouble(18);
            ft.FontName = ftn;
            ft.FontSize = ftsz;
            fts.Append(ft);

            ft = new DocumentFormat.OpenXml.Spreadsheet.Font();
            ft.Append(new Bold());
            ftn         = new FontName();
            ftn.Val     = StringValue.FromString("Arial");
            ftsz        = new FontSize();
            ftsz.Val    = DoubleValue.FromDouble(11);
            ft.FontName = ftn;
            ft.FontSize = ftsz;
            fts.Append(ft);

            fts.Count = UInt32Value.FromUInt32((uint)fts.ChildElements.Count);
            #endregion

            #region fills
            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("00efffd9");
            patternFill.BackgroundColor     = new BackgroundColor();
            patternFill.BackgroundColor.Rgb = patternFill.ForegroundColor.Rgb;
            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("00f8e8d6");
            patternFill.BackgroundColor     = new BackgroundColor();
            patternFill.BackgroundColor.Rgb = patternFill.ForegroundColor.Rgb;
            fill.PatternFill                = patternFill;
            fills.Append(fill);

            fills.Count = UInt32Value.FromUInt32((uint)fills.ChildElements.Count);
            #endregion

            #region borders
            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;
            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);
            borders.Count = UInt32Value.FromUInt32((uint)borders.ChildElements.Count);
            #endregion

            #region csfs (CellStyleFormats)
            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);
            #endregion


            uint        iExcelIndex = 164;
            var         nfs         = new DocumentFormat.OpenXml.Spreadsheet.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);

            var nfDateTime = new DocumentFormat.OpenXml.Spreadsheet.NumberingFormat();
            nfDateTime.NumberFormatId = UInt32Value.FromUInt32(iExcelIndex++);
            nfDateTime.FormatCode     = StringValue.FromString("dd/mm/yyyy hh:mm:ss");
            nfs.Append(nfDateTime);

            var nfDate = new DocumentFormat.OpenXml.Spreadsheet.NumberingFormat();
            nfDate.NumberFormatId = UInt32Value.FromUInt32(iExcelIndex++);
            nfDate.FormatCode     = StringValue.FromString("dd/mm/yyyy");
            nfs.Append(nfDate);

            var nf4decimal = new DocumentFormat.OpenXml.Spreadsheet.NumberingFormat();
            nf4decimal.NumberFormatId = UInt32Value.FromUInt32(iExcelIndex++);
            nf4decimal.FormatCode     = StringValue.FromString("#,##0.0000");
            nfs.Append(nf4decimal);

            // #,##0.00 is also Excel style index 4
            var nf2decimal = new DocumentFormat.OpenXml.Spreadsheet.NumberingFormat();
            nf2decimal.NumberFormatId = UInt32Value.FromUInt32(iExcelIndex++);
            nf2decimal.FormatCode     = StringValue.FromString("#,##0.00");
            nfs.Append(nf2decimal);

            // @ is also Excel style index 49
            var nfForcedText = new DocumentFormat.OpenXml.Spreadsheet.NumberingFormat();
            nfForcedText.NumberFormatId = UInt32Value.FromUInt32(iExcelIndex++);
            nfForcedText.FormatCode     = StringValue.FromString("@");
            nfs.Append(nfForcedText);

            // #,##0.00 is also Excel style index 4
            var nf0decimal = new DocumentFormat.OpenXml.Spreadsheet.NumberingFormat();
            nf0decimal.NumberFormatId = UInt32Value.FromUInt32(iExcelIndex++);
            nf0decimal.FormatCode     = StringValue.FromString("#,##0");
            nfs.Append(nf0decimal);

            // index 1
            cf = new CellFormat();
            cf.NumberFormatId    = nfDate.NumberFormatId;
            cf.FontId            = 0; //Arial 11
            cf.FillId            = 0;
            cf.BorderId          = 0;
            cf.FormatId          = 0;
            cf.ApplyNumberFormat = BooleanValue.FromBoolean(true);
            cfs.Append(cf);

            // index 2
            cf = new CellFormat();
            cf.NumberFormatId    = nf4decimal.NumberFormatId;
            cf.FontId            = 0; //Arial 11
            cf.FillId            = 0;
            cf.BorderId          = 0;
            cf.FormatId          = 0;
            cf.ApplyNumberFormat = BooleanValue.FromBoolean(true);
            cfs.Append(cf);

            // index 3
            cf = new CellFormat();
            cf.NumberFormatId    = nf0decimal.NumberFormatId;
            cf.FontId            = 0; //Arial 11
            cf.FillId            = 0;
            cf.BorderId          = 0;
            cf.FormatId          = 0;
            cf.ApplyNumberFormat = BooleanValue.FromBoolean(true);
            cfs.Append(cf);

            // index 4
            cf = new CellFormat();
            cf.NumberFormatId    = nfForcedText.NumberFormatId;
            cf.FontId            = 0; //Arial 11
            cf.FillId            = 0; //NO Fill
            cf.BorderId          = 0;
            cf.FormatId          = 0;
            cf.ApplyNumberFormat = BooleanValue.FromBoolean(true);
            cfs.Append(cf);

            // index 5
            cf = new CellFormat();
            cf.NumberFormatId    = nfForcedText.NumberFormatId;
            cf.FontId            = 1; //Verdana 18
            cf.FillId            = 0; //NO Fill
            cf.BorderId          = 0;
            cf.FormatId          = 0;
            cf.ApplyNumberFormat = BooleanValue.FromBoolean(true);
            cfs.Append(cf);

            // index 6
            // column text
            cf = new CellFormat();
            cf.NumberFormatId    = nfForcedText.NumberFormatId;
            cf.FontId            = 2; //Arial 11, Bold
            cf.FillId            = 0; //NO Fill
            cf.BorderId          = 0;
            cf.FormatId          = 0;
            cf.ApplyNumberFormat = BooleanValue.FromBoolean(true);
            cfs.Append(cf);

            // index 7
            cf = new CellFormat();
            cf.NumberFormatId    = nfForcedText.NumberFormatId;
            cf.FontId            = 0; //Arial 11
            cf.FillId            = 3; //Light Orange
            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            = 2; //Arial 11, Bold
            cf.FillId            = 2; //Light Green
            cf.BorderId          = 0;
            cf.FormatId          = 0;
            cf.ApplyNumberFormat = BooleanValue.FromBoolean(true);
            cfs.Append(cf);

            // index 9
            cf = new CellFormat();
            cf.NumberFormatId    = nfForcedText.NumberFormatId;
            cf.FontId            = 0; //Arial 11
            cf.FillId            = 0; //NO Fill
            cf.BorderId          = 0;
            cf.FormatId          = 0;
            cf.ApplyNumberFormat = BooleanValue.FromBoolean(true);
            cf.Append(new Alignment()
            {
                WrapText = true
            });
            cfs.Append(cf);

            // index 10
            cf = new CellFormat();
            cf.NumberFormatId    = nfForcedText.NumberFormatId;
            cf.FontId            = 0; //Arial 11
            cf.FillId            = 3; //Light Orange
            cf.BorderId          = 0;
            cf.FormatId          = 0;
            cf.ApplyNumberFormat = BooleanValue.FromBoolean(true);
            cf.Append(new Alignment()
            {
                WrapText = true
            });
            cfs.Append(cf);

            nfs.Count = UInt32Value.FromUInt32((uint)nfs.ChildElements.Count);
            cfs.Count = UInt32Value.FromUInt32((uint)cfs.ChildElements.Count);

            ss.Append(nfs);
            ss.Append(fts);
            ss.Append(fills);
            ss.Append(borders);
            ss.Append(csfs);
            ss.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);
            ss.Append(css);

            DifferentialFormats dfs = new DifferentialFormats();
            dfs.Count = 0;
            ss.Append(dfs);

            TableStyles tss = new TableStyles();
            tss.Count             = 0;
            tss.DefaultTableStyle = StringValue.FromString("TableStyleMedium9");
            tss.DefaultPivotStyle = StringValue.FromString("PivotStyleLight16");
            ss.Append(tss);

            return(ss);
        }
Beispiel #32
0
        private void CreateWorkbookStylesPart(WorkbookStylesPart part)
        {
            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");

            Fonts fonts = new Fonts {
                Count = 2, KnownFonts = true
            };
            Font font = new Font();

            font.Append(new FontSize {
                Val = 11
            });
            font.Append(new Color {
                Theme = 1
            });
            font.Append(new FontName {
                Val = "Calibri"
            });
            font.Append(new FontFamilyNumbering {
                Val = 2
            });
            font.Append(new FontScheme {
                Val = FontSchemeValues.Minor
            });
            fonts.Append(font);

            Font fontHeader = new Font();

            fontHeader.Append(new Bold());
            fontHeader.Append(new FontSize {
                Val = 11
            });
            fontHeader.Append(new Color {
                Theme = 1
            });
            fontHeader.Append(new FontName {
                Val = "Calibri"
            });
            fontHeader.Append(new FontFamilyNumbering {
                Val = 2
            });
            fontHeader.Append(new FontScheme {
                Val = FontSchemeValues.Minor
            });
            fonts.Append(fontHeader);

            Fills fills = new Fills {
                Count = 1
            };
            Fill fill1 = new Fill(new PatternFill {
                PatternType = PatternValues.None
            });

            fills.Append(fill1);

            Borders borders = new Borders {
                Count = 1
            };
            Border border = new Border();

            border.Append(new LeftBorder());
            border.Append(new RightBorder());
            border.Append(new TopBorder());
            border.Append(new BottomBorder());
            border.Append(new DiagonalBorder());
            borders.Append(border);

            // Numbers
            NumberingFormats numberingFormats = new NumberingFormats {
                Count = 0
            };

            for (int index = 0; index < Table.Columns.Count; index++)
            {
                var tableColumn = Table.Columns[index];
                if (tableColumn.Format != null)
                {
                    numberingFormats.Count++;
                    numberingFormats.Append(new NumberingFormat {
                        NumberFormatId = 164 + (uint)index, FormatCode = tableColumn.Format
                    });
                }
            }

            CellStyleFormats cellStyleFormats = new CellStyleFormats {
                Count = 2
            };

            cellStyleFormats.Append(new CellFormat {
                NumberFormatId = 0, FontId = 0, FillId = 0, BorderId = 0
            });

            CellFormats cellFormats = new CellFormats {
                Count = 3
            };

            // Default
            cellFormats.Append(new CellFormat {
                NumberFormatId = 0, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0
            });
            // Date
            cellFormats.Append(new CellFormat {
                NumberFormatId = 14, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = true
            });
            // Header
            cellFormats.Append(new CellFormat {
                NumberFormatId = 0, FontId = 1, FillId = 0, BorderId = 0, FormatId = 0, ApplyFont = true
            });

            // Columns
            for (int index = 0; index < Table.Columns.Count; index++)
            {
                var tableColumn = Table.Columns[index];
                _styleIndex[tableColumn] = cellFormats.Count;
                if (tableColumn.Format != null)
                {
                    cellFormats.Append(new CellFormat {
                        NumberFormatId = 164 + (uint)index, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0, ApplyNumberFormat = true
                    });
                }
                else
                {
                    cellFormats.Append(new CellFormat {
                        NumberFormatId = 0, FontId = 0, FillId = 0, BorderId = 0, FormatId = 0
                    });
                }

                cellFormats.Count++;
            }


            CellStyles cellStyles = new CellStyles {
                Count = 1
            };
            CellStyle cellStyle1 = new CellStyle {
                Name = "Normal", FormatId = 0, BuiltinId = 0
            };

            cellStyles.Append(cellStyle1);
            DifferentialFormats differentialFormats = new DifferentialFormats {
                Count = 0
            };
            TableStyles tableStyles = new TableStyles {
                Count = 0, DefaultTableStyle = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleLight16"
            };

            StylesheetExtensionList stylesheetExtensionList = new StylesheetExtensionList();

            stylesheet.Append(numberingFormats);
            stylesheet.Append(fonts);
            stylesheet.Append(fills);
            stylesheet.Append(borders);
            stylesheet.Append(cellStyleFormats);
            stylesheet.Append(cellFormats);
            stylesheet.Append(cellStyles);
            stylesheet.Append(differentialFormats);
            stylesheet.Append(tableStyles);
            stylesheet.Append(stylesheetExtensionList);

            part.Stylesheet = stylesheet;
        }
        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);
        }
Beispiel #34
0
        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);
        }
        public ExportDataStylesheet()
        {
            //Create Font styles
            Fonts fts = new Fonts();

            CreateFontStyles(fts);

            //Create fill styles
            Fills fills = new Fills();

            CreateFillStyles(fills);

            //Create border styles
            Borders borders = new Borders();

            CreateBorderStyles(borders);

            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);

            //Create DateTime Format
            NumberingFormat nfDateTime = CreateNumberFormat(ref iExcelIndex, nfs, "d/mm/yyyy h:mm AM/PM");

            NumberingFormat nfDate = CreateNumberFormat(ref iExcelIndex, nfs, "d/mm/yyyy");


            NumberingFormat nfTime = CreateNumberFormat(ref iExcelIndex, nfs, "h:mm AM/PM");


            NumberingFormat nfinteger = CreateNumberFormat(ref iExcelIndex, nfs, "#,##0");


            // #,##0.00 is also Excel style index 4
            NumberingFormat nf3Decimal = CreateNumberFormat(ref iExcelIndex, nfs, "#,##0.000");

            // @ is also Excel style index 49
            NumberingFormat nfForcedText = CreateNumberFormat(ref iExcelIndex, nfs, "@");

            NumberingFormat nfcurrency = CreateNumberFormat(ref iExcelIndex, nfs, "$#,##0.00");


            //  // index 1
            // Format dd/mm/yyyy
            CreateCellFormat(cfs, 14);

            // index 2
            // Format h:mm:ss AM/PM
            CreateCellFormat(cfs, 19);

            // index 3
            // Format #,##0.00
            CreateCellFormat(cfs, 4);

            // index 4
            CreateCellFormat(cfs, nfDateTime.NumberFormatId);

            // index 5
            CreateCellFormat(cfs, nfinteger.NumberFormatId);

            // index 6
            CreateCellFormat(cfs, nf3Decimal.NumberFormatId);

            // index 7
            CreateCellFormat(cfs, nfForcedText.NumberFormatId);

            // index 8
            // wrap text style
            CreateWrapTextCellFormat(cfs);

            // index 9
            CreateCellFormat(cfs, nfcurrency.NumberFormatId);

            // index 10
            CreateCellFormat(cfs, nfTime.NumberFormatId);



            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);
        }
Beispiel #36
0
        private void AddConditionalFormatting()
        {
            //use openxml directly to apply conditional formatting.
            using (SpreadsheetDocument report = SpreadsheetDocument.Open(fileName, true))
            {
                Workbook workbook = report.WorkbookPart.Workbook;
                WorksheetPart worksheetPart = workbook.WorkbookPart.WorksheetParts.First();

                DifferentialFormats differentialFormats = new DifferentialFormats() { Count = (UInt32Value)2U };

                DifferentialFormat lessThanFormat = new DifferentialFormat();
                Font lessThanFont = new Font();
                lessThanFont.Append(new Condense() { Val = false });
                lessThanFont.Append(new Extend() { Val = false });
                lessThanFont.Append(new Color() { Rgb = "FF9C0006" });
                Fill lessThanFill = new Fill();
                PatternFill lessThanPatternFill = new PatternFill();
                lessThanPatternFill.Append(new BackgroundColor() { Rgb = "FFFFC7CE" });
                lessThanFill.Append(lessThanPatternFill);
                lessThanFormat.Append(lessThanFont);
                lessThanFormat.Append(lessThanFill);

                DifferentialFormat greaterThanFormat = new DifferentialFormat();
                Font greaterThanFont = new Font();
                greaterThanFont.Append(new Condense() { Val = false });
                greaterThanFont.Append(new Extend() { Val = false });
                greaterThanFont.Append(new Color() { Rgb = "FF006100" });
                Fill greatherThanFill = new Fill();
                PatternFill greaterThanPatternFill = new PatternFill();
                greaterThanPatternFill.Append(new BackgroundColor() { Rgb = "FFC6EFCE" });
                greatherThanFill.Append(greaterThanPatternFill);
                greaterThanFormat.Append(greaterThanFont);
                greaterThanFormat.Append(greatherThanFill);

                differentialFormats.Append(lessThanFormat);
                differentialFormats.Append(greaterThanFormat);
                workbook.WorkbookPart.WorkbookStylesPart.Stylesheet.Append(differentialFormats);

                ConditionalFormatting conditionalFormatting = new ConditionalFormatting() {
                    SequenceOfReferences = new ListValue<StringValue>() { InnerText = "D2:D10" }
                };

                ConditionalFormattingRule greaterThanRule = new ConditionalFormattingRule()
                {
                    Type = ConditionalFormatValues.CellIs,
                    FormatId = (UInt32Value)1U,
                    Priority = 2,
                    Operator = ConditionalFormattingOperatorValues.GreaterThan
                };
                Formula greaterThanFormula = new Formula();
                greaterThanFormula.Text = "0";
                greaterThanRule.Append(greaterThanFormula);

                ConditionalFormattingRule lessThanRule = new ConditionalFormattingRule()
                {
                    Type = ConditionalFormatValues.CellIs,
                    FormatId = (UInt32Value)0U,
                    Priority = 1,
                    Operator = ConditionalFormattingOperatorValues.LessThan
                };
                Formula lessThanFormula = new Formula();
                lessThanFormula.Text = "0";
                lessThanRule.Append(lessThanFormula);

                conditionalFormatting.Append(greaterThanRule);
                conditionalFormatting.Append(lessThanRule);

                worksheetPart.Worksheet.Append(conditionalFormatting);

                report.WorkbookPart.Workbook.Save();
                report.Close();
            }
        }
Beispiel #37
0
        // Generates content of workbookStylesPart1.
        // (borders needed for user to resize tables). Other style content skipped.
        private static void GenerateWorkbookStylesContent(WorkbookStylesPart workbookStylesPart1)
        {
            Stylesheet stylesheet1 = new Stylesheet();
            // if your data includes a table, this renders the blue borders to make it easier to see.
            DifferentialFormats differentialFormats1 = new DifferentialFormats()
            {
                Count = (UInt32Value)2U
            };
            DifferentialFormat differentialFormat1 = new DifferentialFormat();
            NumberingFormat    numberingFormat1    = new NumberingFormat()
            {
                NumberFormatId = (UInt32Value)1U, FormatCode = "0"
            };

            differentialFormat1.Append(numberingFormat1);
            DifferentialFormat differentialFormat2 = new DifferentialFormat();
            Border             border3             = new Border()
            {
                DiagonalUp = false, DiagonalDown = false
            };
            LeftBorder leftBorder3 = new LeftBorder()
            {
                Style = BorderStyleValues.Thin
            };
            Color color5 = new Color()
            {
                Indexed = (UInt32Value)12U
            };

            leftBorder3.Append(color5);
            RightBorder rightBorder3 = new RightBorder()
            {
                Style = BorderStyleValues.Thin
            };
            Color color6 = new Color()
            {
                Indexed = (UInt32Value)12U
            };

            rightBorder3.Append(color6);
            TopBorder topBorder3 = new TopBorder()
            {
                Style = BorderStyleValues.Thin
            };
            Color color7 = new Color()
            {
                Indexed = (UInt32Value)12U
            };

            topBorder3.Append(color7);
            BottomBorder bottomBorder3 = new BottomBorder()
            {
                Style = BorderStyleValues.Thin
            };
            Color color8 = new Color()
            {
                Indexed = (UInt32Value)12U
            };

            bottomBorder3.Append(color8);
            border3.Append(leftBorder3);
            border3.Append(rightBorder3);
            border3.Append(topBorder3);
            border3.Append(bottomBorder3);
            differentialFormat2.Append(border3);
            differentialFormats1.Append(differentialFormat1);
            differentialFormats1.Append(differentialFormat2);
            stylesheet1.Append(differentialFormats1); // border used for table
            workbookStylesPart1.Stylesheet = stylesheet1;
        }
Beispiel #38
0
        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);
        }
Beispiel #39
0
        public CustomStylesheet()
        {
            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);

            //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);

            return;
        }
Beispiel #40
0
        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);
        }
Beispiel #41
0
        private static Stylesheet CreateStylesheet(IOrderedEnumerable <ExcelColumnProperty> excelColProperties)
        {
            Stylesheet ss = new Stylesheet();

            // set default styles

            Fonts fonts = new Fonts();
            Font  font  = new Font()
            {
                FontName = new FontName()
                {
                    Val = "Calibri"
                },
                FontSize = new FontSize()
                {
                    Val = 11
                }
            };

            fonts.Append(font);
            fonts.Count = (uint)fonts.ChildElements.Count;

            Fills fills = new Fills();
            Fill  fill;

            fill = new Fill()
            {
                PatternFill = new PatternFill()
                {
                    PatternType = PatternValues.None
                }
            };
            fills.Append(fill);
            fill = new Fill()
            {
                PatternFill = new PatternFill()
                {
                    PatternType = PatternValues.Gray125
                }
            };
            fills.Append(fill);
            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()
            });
            borders.Count = (uint)borders.ChildElements.Count;

            CellStyles cellStyles = new CellStyles();

            cellStyles.Append(new CellStyle()
            {
                Name      = "Normal",
                BuiltinId = 0,
                FormatId  = 0
            });
            cellStyles.Count = (uint)cellStyles.ChildElements.Count;

            TableStyles tableStyles = new TableStyles()
            {
                Count             = 0,
                DefaultTableStyle = "TableStyleMedium2",
                DefaultPivotStyle = "PivotStyleMedium9"
            };

            DifferentialFormats dxfs = new DifferentialFormats()
            {
                Count = 0
            };

            CellStyleFormats styleFormats = new CellStyleFormats();

            styleFormats.Append(new CellFormat()
            {
                NumberFormatId = 0,
                FontId         = 0,
                FillId         = 0,
                BorderId       = 0
            });
            styleFormats.Count = (uint)styleFormats.ChildElements.Count;

            // set styles according to the entity setting.
            Dictionary <uint, int> embeddedStyle = new Dictionary <uint, int>();           // key: NumberFormatId, value: cell format index
            uint                      nbrFmtId;
            int                       cellFormatIndex          = -1;
            uint                      customizedNumberFormatId = 164;
            NumberingFormats          nbrFormats = new NumberingFormats();
            NumberingFormat           nbrFmt;
            Dictionary <string, uint> nbrFmtIds   = new Dictionary <string, uint>();
            CellFormats               cellFormats = new CellFormats();
            CellFormat                cellFmt;

            foreach (ExcelColumnProperty excelColProperty in excelColProperties)
            {
                // handle custom number format
                if (string.IsNullOrEmpty(excelColProperty.ExcelColumnAttr.NumberingFormatString) == false)
                {
                    // customized format
                    if (nbrFmtIds.ContainsKey(excelColProperty.ExcelColumnAttr.NumberingFormatString) == false)
                    {
                        nbrFmt = new NumberingFormat();
                        nbrFmt.NumberFormatId = customizedNumberFormatId++;
                        nbrFmt.FormatCode     = excelColProperty.ExcelColumnAttr.NumberingFormatString;
                        nbrFormats.Append(nbrFmt);
                        nbrFmtIds.Add(nbrFmt.FormatCode, nbrFmt.NumberFormatId);
                    }

                    nbrFmtId = nbrFmtIds[excelColProperty.ExcelColumnAttr.NumberingFormatString];
                }
                else
                {
                    nbrFmtId = excelColProperty.ExcelColumnAttr.NumberFormatId;
                }

                if (embeddedStyle.ContainsKey(nbrFmtId) == false)
                {
                    cellFormatIndex++;
                    cellFmt = new CellFormat();
                    cellFmt.NumberFormatId = nbrFmtId;
                    cellFmt.FontId         = 0;
                    cellFmt.FillId         = 0;
                    cellFmt.BorderId       = 0;
                    cellFormats.Append(cellFmt);
                    embeddedStyle.Add(nbrFmtId, cellFormatIndex);
                }

                excelColProperty.CellFormatIndex = embeddedStyle[nbrFmtId];
            }
            nbrFormats.Count  = (uint)nbrFormats.ChildElements.Count;
            cellFormats.Count = (uint)cellFormats.ChildElements.Count;

            // the sequence of appending is significant
            if (nbrFormats.Count > 0)
            {
                ss.Append(nbrFormats);
            }
            ss.Append(fonts);
            ss.Append(fills);
            ss.Append(borders);
            ss.Append(styleFormats);
            ss.Append(cellFormats);
            ss.Append(cellStyles);
            ss.Append(dxfs);
            ss.Append(tableStyles);

            return(ss);
        }
Beispiel #42
0
        // 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;
        }
        // Generates content of workbookStylesPart1.
        private void GenerateWorkbookStylesPart1Content(WorkbookStylesPart workbookStylesPart1)
        {
            Stylesheet stylesheet1 = new Stylesheet();

            NumberingFormats numberingFormats1 = new NumberingFormats(){ Count = (UInt32Value)5U };
            NumberingFormat numberingFormat1 = new NumberingFormat(){ NumberFormatId = (UInt32Value)186U, FormatCode = "_(\"$\"* #,##0.00_);_(\"$\"* \\(#,##0.00\\);_(\"$\"* \"-\"??_);_(@_)" };
            NumberingFormat numberingFormat2 = new NumberingFormat(){ NumberFormatId = (UInt32Value)187U, FormatCode = "_(* #,##0.00_);_(* \\(#,##0.00\\);_(* \"-\"??_);_(@_)" };
            NumberingFormat numberingFormat3 = new NumberingFormat(){ NumberFormatId = (UInt32Value)224U, FormatCode = "_-* #,##0\\ _€_-;\\-* #,##0\\ _€_-;_-* \"-\"??\\ _€_-;_-@_-" };
            NumberingFormat numberingFormat4 = new NumberingFormat(){ NumberFormatId = (UInt32Value)225U, FormatCode = "\"$\"\\ #,##0.00" };
            NumberingFormat numberingFormat5 = new NumberingFormat(){ NumberFormatId = (UInt32Value)226U, FormatCode = "\"$\"\\ #,##0" };

            numberingFormats1.Append(numberingFormat1);
            numberingFormats1.Append(numberingFormat2);
            numberingFormats1.Append(numberingFormat3);
            numberingFormats1.Append(numberingFormat4);
            numberingFormats1.Append(numberingFormat5);

            Fonts fonts1 = new Fonts(){ Count = (UInt32Value)23U };

            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" };
            FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering(){ Val = 2 };

            font2.Append(fontSize2);
            font2.Append(fontName2);
            font2.Append(fontFamilyNumbering1);

            Font font3 = new Font();
            Bold bold1 = new Bold();
            FontSize fontSize3 = new FontSize(){ Val = 10D };
            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 = 10D };
            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();
            Bold bold2 = new Bold();
            FontSize fontSize5 = new FontSize(){ Val = 10D };
            Color color1 = 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(color1);
            font5.Append(fontName5);
            font5.Append(fontFamilyNumbering4);

            Font font6 = new Font();
            FontSize fontSize6 = new FontSize(){ Val = 10D };
            Color color2 = new Color(){ Indexed = (UInt32Value)9U };
            FontName fontName6 = new FontName(){ Val = "Arial" };
            FontFamilyNumbering fontFamilyNumbering5 = new FontFamilyNumbering(){ Val = 2 };

            font6.Append(fontSize6);
            font6.Append(color2);
            font6.Append(fontName6);
            font6.Append(fontFamilyNumbering5);

            Font font7 = new Font();
            Underline underline1 = new Underline();
            FontSize fontSize7 = new FontSize(){ Val = 7.5D };
            Color color3 = new Color(){ Indexed = (UInt32Value)12U };
            FontName fontName7 = new FontName(){ Val = "Arial" };
            FontFamilyNumbering fontFamilyNumbering6 = new FontFamilyNumbering(){ Val = 2 };

            font7.Append(underline1);
            font7.Append(fontSize7);
            font7.Append(color3);
            font7.Append(fontName7);
            font7.Append(fontFamilyNumbering6);

            Font font8 = new Font();
            Bold bold3 = new Bold();
            FontSize fontSize8 = new FontSize(){ Val = 12D };
            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 color4 = new Color(){ Indexed = (UInt32Value)9U };
            FontName fontName9 = new FontName(){ Val = "Arial" };
            FontFamilyNumbering fontFamilyNumbering8 = new FontFamilyNumbering(){ Val = 2 };

            font9.Append(bold4);
            font9.Append(fontSize9);
            font9.Append(color4);
            font9.Append(fontName9);
            font9.Append(fontFamilyNumbering8);

            Font font10 = new Font();
            FontSize fontSize10 = new FontSize(){ Val = 9D };
            Color color5 = new Color(){ Indexed = (UInt32Value)9U };
            FontName fontName10 = new FontName(){ Val = "Arial" };
            FontFamilyNumbering fontFamilyNumbering9 = new FontFamilyNumbering(){ Val = 2 };

            font10.Append(fontSize10);
            font10.Append(color5);
            font10.Append(fontName10);
            font10.Append(fontFamilyNumbering9);

            Font font11 = new Font();
            Bold bold5 = new Bold();
            FontSize fontSize11 = new FontSize(){ Val = 9D };
            FontName fontName11 = new FontName(){ Val = "Arial" };
            FontFamilyNumbering fontFamilyNumbering10 = new FontFamilyNumbering(){ Val = 2 };

            font11.Append(bold5);
            font11.Append(fontSize11);
            font11.Append(fontName11);
            font11.Append(fontFamilyNumbering10);

            Font font12 = new Font();
            FontSize fontSize12 = new FontSize(){ Val = 9D };
            FontName fontName12 = new FontName(){ Val = "Arial" };
            FontFamilyNumbering fontFamilyNumbering11 = new FontFamilyNumbering(){ Val = 2 };

            font12.Append(fontSize12);
            font12.Append(fontName12);
            font12.Append(fontFamilyNumbering11);

            Font font13 = new Font();
            Bold bold6 = new Bold();
            FontSize fontSize13 = new FontSize(){ Val = 9D };
            Color color6 = new Color(){ Indexed = (UInt32Value)56U };
            FontName fontName13 = new FontName(){ Val = "Arial" };
            FontFamilyNumbering fontFamilyNumbering12 = new FontFamilyNumbering(){ Val = 2 };

            font13.Append(bold6);
            font13.Append(fontSize13);
            font13.Append(color6);
            font13.Append(fontName13);
            font13.Append(fontFamilyNumbering12);

            Font font14 = new Font();
            Bold bold7 = new Bold();
            FontSize fontSize14 = new FontSize(){ Val = 8D };
            FontName fontName14 = new FontName(){ Val = "Arial" };
            FontFamilyNumbering fontFamilyNumbering13 = new FontFamilyNumbering(){ Val = 2 };

            font14.Append(bold7);
            font14.Append(fontSize14);
            font14.Append(fontName14);
            font14.Append(fontFamilyNumbering13);

            Font font15 = new Font();
            Bold bold8 = new Bold();
            FontSize fontSize15 = new FontSize(){ Val = 8D };
            Color color7 = new Color(){ Indexed = (UInt32Value)9U };
            FontName fontName15 = new FontName(){ Val = "Arial" };
            FontFamilyNumbering fontFamilyNumbering14 = new FontFamilyNumbering(){ Val = 2 };

            font15.Append(bold8);
            font15.Append(fontSize15);
            font15.Append(color7);
            font15.Append(fontName15);
            font15.Append(fontFamilyNumbering14);

            Font font16 = new Font();
            Bold bold9 = new Bold();
            FontSize fontSize16 = new FontSize(){ Val = 10D };
            Color color8 = new Color(){ Indexed = (UInt32Value)10U };
            FontName fontName16 = new FontName(){ Val = "Arial" };
            FontFamilyNumbering fontFamilyNumbering15 = new FontFamilyNumbering(){ Val = 2 };

            font16.Append(bold9);
            font16.Append(fontSize16);
            font16.Append(color8);
            font16.Append(fontName16);
            font16.Append(fontFamilyNumbering15);

            Font font17 = new Font();
            FontSize fontSize17 = new FontSize(){ Val = 8D };
            FontName fontName17 = new FontName(){ Val = "Arial" };
            FontFamilyNumbering fontFamilyNumbering16 = new FontFamilyNumbering(){ Val = 2 };

            font17.Append(fontSize17);
            font17.Append(fontName17);
            font17.Append(fontFamilyNumbering16);

            Font font18 = new Font();
            FontSize fontSize18 = new FontSize(){ Val = 8D };
            Color color9 = new Color(){ Indexed = (UInt32Value)9U };
            FontName fontName18 = new FontName(){ Val = "Arial" };
            FontFamilyNumbering fontFamilyNumbering17 = new FontFamilyNumbering(){ Val = 2 };

            font18.Append(fontSize18);
            font18.Append(color9);
            font18.Append(fontName18);
            font18.Append(fontFamilyNumbering17);

            Font font19 = new Font();
            Bold bold10 = new Bold();
            FontSize fontSize19 = new FontSize(){ Val = 15D };
            FontName fontName19 = new FontName(){ Val = "Arial" };
            FontFamilyNumbering fontFamilyNumbering18 = new FontFamilyNumbering(){ Val = 2 };

            font19.Append(bold10);
            font19.Append(fontSize19);
            font19.Append(fontName19);
            font19.Append(fontFamilyNumbering18);

            Font font20 = new Font();
            Bold bold11 = new Bold();
            FontSize fontSize20 = new FontSize(){ Val = 9D };
            Color color10 = new Color(){ Indexed = (UInt32Value)12U };
            FontName fontName20 = new FontName(){ Val = "Arial" };
            FontFamilyNumbering fontFamilyNumbering19 = new FontFamilyNumbering(){ Val = 2 };

            font20.Append(bold11);
            font20.Append(fontSize20);
            font20.Append(color10);
            font20.Append(fontName20);
            font20.Append(fontFamilyNumbering19);

            Font font21 = new Font();
            Underline underline2 = new Underline();
            FontSize fontSize21 = new FontSize(){ Val = 12D };
            Color color11 = new Color(){ Indexed = (UInt32Value)12U };
            FontName fontName21 = new FontName(){ Val = "Arial" };
            FontFamilyNumbering fontFamilyNumbering20 = new FontFamilyNumbering(){ Val = 2 };

            font21.Append(underline2);
            font21.Append(fontSize21);
            font21.Append(color11);
            font21.Append(fontName21);
            font21.Append(fontFamilyNumbering20);

            Font font22 = new Font();
            Bold bold12 = new Bold();
            FontSize fontSize22 = new FontSize(){ Val = 11D };
            FontName fontName22 = new FontName(){ Val = "Arial" };
            FontFamilyNumbering fontFamilyNumbering21 = new FontFamilyNumbering(){ Val = 2 };

            font22.Append(bold12);
            font22.Append(fontSize22);
            font22.Append(fontName22);
            font22.Append(fontFamilyNumbering21);

            Font font23 = new Font();
            FontSize fontSize23 = new FontSize(){ Val = 12D };
            FontName fontName23 = new FontName(){ Val = "Arial" };
            FontFamilyNumbering fontFamilyNumbering22 = new FontFamilyNumbering(){ Val = 2 };

            font23.Append(fontSize23);
            font23.Append(fontName23);
            font23.Append(fontFamilyNumbering22);

            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);
            fonts1.Append(font22);
            fonts1.Append(font23);

            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)10U };

            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 color12 = new Color(){ Indexed = (UInt32Value)64U };

            leftBorder2.Append(color12);

            RightBorder rightBorder2 = new RightBorder(){ Style = BorderStyleValues.Thin };
            Color color13 = new Color(){ Indexed = (UInt32Value)64U };

            rightBorder2.Append(color13);

            TopBorder topBorder2 = new TopBorder(){ Style = BorderStyleValues.Thin };
            Color color14 = new Color(){ Indexed = (UInt32Value)64U };

            topBorder2.Append(color14);
            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 color15 = new Color(){ Indexed = (UInt32Value)64U };

            leftBorder3.Append(color15);

            RightBorder rightBorder3 = new RightBorder(){ Style = BorderStyleValues.Thin };
            Color color16 = new Color(){ Indexed = (UInt32Value)64U };

            rightBorder3.Append(color16);

            TopBorder topBorder3 = new TopBorder(){ Style = BorderStyleValues.Thin };
            Color color17 = new Color(){ Indexed = (UInt32Value)64U };

            topBorder3.Append(color17);

            BottomBorder bottomBorder3 = new BottomBorder(){ Style = BorderStyleValues.Thin };
            Color color18 = new Color(){ Indexed = (UInt32Value)64U };

            bottomBorder3.Append(color18);
            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 color19 = new Color(){ Indexed = (UInt32Value)64U };

            leftBorder4.Append(color19);

            RightBorder rightBorder4 = new RightBorder(){ Style = BorderStyleValues.Thin };
            Color color20 = new Color(){ Indexed = (UInt32Value)64U };

            rightBorder4.Append(color20);
            TopBorder topBorder4 = new TopBorder();

            BottomBorder bottomBorder4 = new BottomBorder(){ Style = BorderStyleValues.Thin };
            Color color21 = new Color(){ Indexed = (UInt32Value)64U };

            bottomBorder4.Append(color21);
            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 color22 = new Color(){ Indexed = (UInt32Value)64U };

            leftBorder5.Append(color22);

            RightBorder rightBorder5 = new RightBorder(){ Style = BorderStyleValues.Thin };
            Color color23 = new Color(){ Indexed = (UInt32Value)64U };

            rightBorder5.Append(color23);
            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 color24 = new Color(){ Indexed = (UInt32Value)64U };

            rightBorder6.Append(color24);
            TopBorder topBorder6 = new TopBorder();

            BottomBorder bottomBorder6 = new BottomBorder(){ Style = BorderStyleValues.Thin };
            Color color25 = new Color(){ Indexed = (UInt32Value)64U };

            bottomBorder6.Append(color25);
            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();

            TopBorder topBorder7 = new TopBorder(){ Style = BorderStyleValues.Thin };
            Color color26 = new Color(){ Indexed = (UInt32Value)64U };

            topBorder7.Append(color26);
            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.Medium };
            Color color27 = new Color(){ Indexed = (UInt32Value)64U };

            leftBorder8.Append(color27);
            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();

            TopBorder topBorder9 = new TopBorder(){ Style = BorderStyleValues.Medium };
            Color color30 = new Color(){ Indexed = (UInt32Value)64U };

            topBorder9.Append(color30);

            BottomBorder bottomBorder9 = new BottomBorder(){ Style = BorderStyleValues.Medium };
            Color color31 = new Color(){ Indexed = (UInt32Value)64U };

            bottomBorder9.Append(color31);
            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(){ Style = BorderStyleValues.Medium };
            Color color32 = new Color(){ Indexed = (UInt32Value)64U };

            rightBorder10.Append(color32);

            TopBorder topBorder10 = new TopBorder(){ Style = BorderStyleValues.Medium };
            Color color33 = new Color(){ Indexed = (UInt32Value)64U };

            topBorder10.Append(color33);

            BottomBorder bottomBorder10 = new BottomBorder(){ Style = BorderStyleValues.Medium };
            Color color34 = new Color(){ Indexed = (UInt32Value)64U };

            bottomBorder10.Append(color34);
            DiagonalBorder diagonalBorder10 = new DiagonalBorder();

            border10.Append(leftBorder10);
            border10.Append(rightBorder10);
            border10.Append(topBorder10);
            border10.Append(bottomBorder10);
            border10.Append(diagonalBorder10);

            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);

            CellStyleFormats cellStyleFormats1 = new CellStyleFormats(){ Count = (UInt32Value)4U };
            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)6U, 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 };

            cellFormat2.Append(alignment1);
            cellFormat2.Append(protection1);
            CellFormat cellFormat3 = new CellFormat(){ NumberFormatId = (UInt32Value)187U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, ApplyFont = false, ApplyFill = false, ApplyBorder = false, ApplyAlignment = false, ApplyProtection = false };
            CellFormat cellFormat4 = 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);
            cellStyleFormats1.Append(cellFormat3);
            cellStyleFormats1.Append(cellFormat4);

            CellFormats cellFormats1 = new CellFormats(){ Count = (UInt32Value)79U };
            CellFormat cellFormat5 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U };
            CellFormat cellFormat6 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true };

            CellFormat cellFormat7 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, 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)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true };

            CellFormat cellFormat9 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, 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)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, 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)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, 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)8U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, 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)8U, FillId = (UInt32Value)4U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, 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)9U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true };
            CellFormat cellFormat15 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)10U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)3U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true };

            CellFormat cellFormat16 = new CellFormat(){ NumberFormatId = (UInt32Value)20U, FontId = (UInt32Value)10U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, 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)8U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true };

            CellFormat cellFormat18 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)8U, FillId = (UInt32Value)6U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, 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)10U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, 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)12U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, 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)11U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true };

            CellFormat cellFormat22 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)11U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, 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)9U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true };
            CellFormat cellFormat24 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)9U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true };
            CellFormat cellFormat25 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)11U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true };

            CellFormat cellFormat26 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)11U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyAlignment = true };
            Alignment alignment13 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center };

            cellFormat26.Append(alignment13);

            CellFormat cellFormat27 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)8U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)4U, FormatId = (UInt32Value)0U, 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)11U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true };

            CellFormat cellFormat29 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)13U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            Alignment alignment15 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Right };

            cellFormat29.Append(alignment15);

            CellFormat cellFormat30 = new CellFormat(){ NumberFormatId = (UInt32Value)224U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)2U, 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)225U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)4U, FormatId = (UInt32Value)3U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            Alignment alignment17 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Right };

            cellFormat31.Append(alignment17);

            CellFormat cellFormat32 = new CellFormat(){ NumberFormatId = (UInt32Value)226U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)3U, ApplyNumberFormat = true, 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)13U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            Alignment alignment19 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Right };

            cellFormat33.Append(alignment19);

            CellFormat cellFormat34 = new CellFormat(){ NumberFormatId = (UInt32Value)226U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)3U, FormatId = (UInt32Value)3U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            Alignment alignment20 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Right };

            cellFormat34.Append(alignment20);

            CellFormat cellFormat35 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)14U, FillId = (UInt32Value)7U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            Alignment alignment21 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Right };

            cellFormat35.Append(alignment21);

            CellFormat cellFormat36 = new CellFormat(){ NumberFormatId = (UInt32Value)226U, FontId = (UInt32Value)4U, FillId = (UInt32Value)7U, BorderId = (UInt32Value)5U, FormatId = (UInt32Value)3U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            Alignment alignment22 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Right };

            cellFormat36.Append(alignment22);

            CellFormat cellFormat37 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)15U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true };
            Alignment alignment23 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center };

            cellFormat37.Append(alignment23);
            CellFormat cellFormat38 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)11U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true };
            CellFormat cellFormat39 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)16U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)6U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true };
            CellFormat cellFormat40 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)13U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)6U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true };
            CellFormat cellFormat41 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)17U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)6U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true };
            CellFormat cellFormat42 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)16U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true };
            CellFormat cellFormat43 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)13U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true };

            CellFormat cellFormat44 = 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 alignment24 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Left };

            cellFormat44.Append(alignment24);
            CellFormat cellFormat45 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)13U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true };
            CellFormat cellFormat46 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)14U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true };

            CellFormat cellFormat47 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            Alignment alignment25 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Left };

            cellFormat47.Append(alignment25);

            CellFormat cellFormat48 = 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 alignment26 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Left };

            cellFormat48.Append(alignment26);
            CellFormat cellFormat49 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true };

            CellFormat cellFormat50 = new CellFormat(){ NumberFormatId = (UInt32Value)20U, FontId = (UInt32Value)11U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            Alignment alignment27 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center };

            cellFormat50.Append(alignment27);
            CellFormat cellFormat51 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)16U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)7U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true };
            CellFormat cellFormat52 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)16U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)8U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true };

            CellFormat cellFormat53 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)18U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)8U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            Alignment alignment28 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center };

            cellFormat53.Append(alignment28);
            CellFormat cellFormat54 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)16U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)9U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true };
            CellFormat cellFormat55 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)16U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true };

            CellFormat cellFormat56 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)18U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            Alignment alignment29 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center };

            cellFormat56.Append(alignment29);
            CellFormat cellFormat57 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)10U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true };

            CellFormat cellFormat58 = new CellFormat(){ NumberFormatId = (UInt32Value)17U, FontId = (UInt32Value)19U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyAlignment = true };
            Alignment alignment30 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Left };

            cellFormat58.Append(alignment30);

            CellFormat cellFormat59 = new CellFormat(){ NumberFormatId = (UInt32Value)17U, FontId = (UInt32Value)10U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyAlignment = true };
            Alignment alignment31 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Left };

            cellFormat59.Append(alignment31);
            CellFormat cellFormat60 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)20U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)1U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true, ApplyProtection = true };
            CellFormat cellFormat61 = new CellFormat(){ NumberFormatId = (UInt32Value)49U, FontId = (UInt32Value)11U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            CellFormat cellFormat62 = new CellFormat(){ NumberFormatId = (UInt32Value)1U, FontId = (UInt32Value)7U, FillId = (UInt32Value)5U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true };

            CellFormat cellFormat63 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)11U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true };
            Alignment alignment32 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Right };

            cellFormat63.Append(alignment32);
            CellFormat cellFormat64 = new CellFormat(){ NumberFormatId = (UInt32Value)1U, FontId = (UInt32Value)10U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true };
            CellFormat cellFormat65 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)5U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true };

            CellFormat cellFormat66 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)21U, FillId = (UInt32Value)8U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            Alignment alignment33 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center };

            cellFormat66.Append(alignment33);

            CellFormat cellFormat67 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)11U, FillId = (UInt32Value)9U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            Alignment alignment34 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Right, Vertical = VerticalAlignmentValues.Center };

            cellFormat67.Append(alignment34);

            CellFormat cellFormat68 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)21U, FillId = (UInt32Value)9U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            Alignment alignment35 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center };

            cellFormat68.Append(alignment35);

            CellFormat cellFormat69 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)21U, FillId = (UInt32Value)10U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            Alignment alignment36 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center };

            cellFormat69.Append(alignment36);
            CellFormat cellFormat70 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)10U, FillId = (UInt32Value)7U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true };

            CellFormat cellFormat71 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)10U, FillId = (UInt32Value)7U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            Alignment alignment37 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center };

            cellFormat71.Append(alignment37);

            CellFormat cellFormat72 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)7U, FillId = (UInt32Value)8U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            Alignment alignment38 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center };

            cellFormat72.Append(alignment38);

            CellFormat cellFormat73 = new CellFormat(){ NumberFormatId = (UInt32Value)49U, FontId = (UInt32Value)7U, FillId = (UInt32Value)8U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            Alignment alignment39 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center };

            cellFormat73.Append(alignment39);

            CellFormat cellFormat74 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)7U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            Alignment alignment40 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center };

            cellFormat74.Append(alignment40);

            CellFormat cellFormat75 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)22U, FillId = (UInt32Value)10U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            Alignment alignment41 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center };

            cellFormat75.Append(alignment41);

            CellFormat cellFormat76 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)22U, FillId = (UInt32Value)11U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            Alignment alignment42 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center };

            cellFormat76.Append(alignment42);

            CellFormat cellFormat77 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)22U, FillId = (UInt32Value)9U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            Alignment alignment43 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center };

            cellFormat77.Append(alignment43);

            CellFormat cellFormat78 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)11U, FillId = (UInt32Value)10U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            Alignment alignment44 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center };

            cellFormat78.Append(alignment44);

            CellFormat cellFormat79 = new CellFormat(){ NumberFormatId = (UInt32Value)16U, FontId = (UInt32Value)10U, FillId = (UInt32Value)12U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            Alignment alignment45 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center };

            cellFormat79.Append(alignment45);
            CellFormat cellFormat80 = new CellFormat(){ NumberFormatId = (UInt32Value)17U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true };
            CellFormat cellFormat81 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)11U, FillId = (UInt32Value)13U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true };

            CellFormat cellFormat82 = new CellFormat(){ NumberFormatId = (UInt32Value)16U, FontId = (UInt32Value)11U, FillId = (UInt32Value)10U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            Alignment alignment46 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center };

            cellFormat82.Append(alignment46);

            CellFormat cellFormat83 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)11U, FillId = (UInt32Value)8U, BorderId = (UInt32Value)2U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true };
            Alignment alignment47 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center };

            cellFormat83.Append(alignment47);

            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);

            CellStyles cellStyles1 = new CellStyles(){ Count = (UInt32Value)4U };
            CellStyle cellStyle1 = new CellStyle(){ Name = "Hipervínculo", FormatId = (UInt32Value)1U, BuiltinId = (UInt32Value)8U };
            CellStyle cellStyle2 = new CellStyle(){ Name = "Millares", FormatId = (UInt32Value)2U, BuiltinId = (UInt32Value)3U };
            CellStyle cellStyle3 = new CellStyle(){ Name = "Moneda", FormatId = (UInt32Value)3U, BuiltinId = (UInt32Value)4U };
            CellStyle cellStyle4 = new CellStyle(){ Name = "Normal", FormatId = (UInt32Value)0U, BuiltinId = (UInt32Value)0U };

            cellStyles1.Append(cellStyle1);
            cellStyles1.Append(cellStyle2);
            cellStyles1.Append(cellStyle3);
            cellStyles1.Append(cellStyle4);
            DifferentialFormats differentialFormats1 = new DifferentialFormats(){ Count = (UInt32Value)0U };
            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;
        }
Beispiel #44
0
        public CustomStylesheet()
        {
            #region Fonts
            var fonts = new Fonts();
            var color = new Color();
            //Font Index 0
            var font     = new DocumentFormat.OpenXml.Spreadsheet.Font();
            var fontName = new FontName {
                Val = StringValue.FromString("Arial")
            };
            var fontSize = new FontSize {
                Val = DoubleValue.FromDouble(9)
            };
            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(10)
            };
            font.FontName = fontName;
            font.FontSize = fontSize;
            font.Bold     = new Bold();
            fonts.Append(font);

            //Font Index 2
            font     = new DocumentFormat.OpenXml.Spreadsheet.Font();
            fontName = new FontName {
                Val = StringValue.FromString("Arial")
            };
            fontSize = new FontSize {
                Val = DoubleValue.FromDouble(15)
            };
            font.FontName = fontName;
            font.FontSize = fontSize;
            font.Bold     = new Bold();
            fonts.Append(font);

            //Font Index 3 Posted
            font     = new DocumentFormat.OpenXml.Spreadsheet.Font();
            fontName = new FontName {
                Val = StringValue.FromString("Arial")
            };
            fontSize = new FontSize {
                Val = DoubleValue.FromDouble(9)
            };
            font.FontName = fontName;
            font.FontSize = fontSize;
            color         = new Color()
            {
                Rgb = new HexBinaryValue()
                {
                    Value = "0000FF"
                }
            };
            font.Color = color;
            fonts.Append(font);

            //Font Index 4 InProgress
            font     = new DocumentFormat.OpenXml.Spreadsheet.Font();
            fontName = new FontName {
                Val = StringValue.FromString("Arial")
            };
            fontSize = new FontSize {
                Val = DoubleValue.FromDouble(9)
            };
            font.FontName = fontName;
            font.FontSize = fontSize;
            color         = new Color()
            {
                Rgb = new HexBinaryValue()
                {
                    Value = "FF8B45"
                }
            };
            font.Color = color;
            fonts.Append(font);

            //Font Index 5 Submitted/resubmitted
            font     = new DocumentFormat.OpenXml.Spreadsheet.Font();
            fontName = new FontName {
                Val = StringValue.FromString("Arial")
            };
            fontSize = new FontSize {
                Val = DoubleValue.FromDouble(9)
            };
            font.FontName = fontName;
            font.FontSize = fontSize;
            color         = new Color()
            {
                Rgb = new HexBinaryValue()
                {
                    Value = "FF0000"
                }
            };
            font.Color = color;
            fonts.Append(font);

            //Font Index 6 Accepted
            font     = new DocumentFormat.OpenXml.Spreadsheet.Font();
            fontName = new FontName {
                Val = StringValue.FromString("Arial")
            };
            fontSize = new FontSize {
                Val = DoubleValue.FromDouble(9)
            };
            font.FontName = fontName;
            font.FontSize = fontSize;
            color         = new Color()
            {
                Rgb = new HexBinaryValue()
                {
                    Value = "2C6100"
                }
            };
            font.Color = color;
            fonts.Append(font);

            //Font Index 7 Dashboard
            font     = new DocumentFormat.OpenXml.Spreadsheet.Font();
            fontName = new FontName {
                Val = StringValue.FromString("Calibri")
            };
            fontSize = new FontSize {
                Val = DoubleValue.FromDouble(15)
            };
            font.FontName = fontName;
            font.FontSize = fontSize;
            fonts.Append(font);

            //Font Index 8
            font     = new DocumentFormat.OpenXml.Spreadsheet.Font();
            fontName = new FontName {
                Val = StringValue.FromString("Calibri")
            };
            fontSize = new FontSize {
                Val = DoubleValue.FromDouble(9)
            };
            font.FontName = fontName;
            font.FontSize = fontSize;
            fonts.Append(font);

            //Font Index 9 Header
            font     = new DocumentFormat.OpenXml.Spreadsheet.Font();
            fontName = new FontName {
                Val = StringValue.FromString("Calibri")
            };
            fontSize = new FontSize {
                Val = DoubleValue.FromDouble(18)
            };
            color = new Color()
            {
                Rgb = new HexBinaryValue()
                {
                    Value = "FFFFFF"
                }
            };
            font.Color    = color;
            font.Bold     = new Bold();
            font.FontName = fontName;
            font.FontSize = fontSize;
            fonts.Append(font);

            //Font Index 10 Body Bold
            font     = new DocumentFormat.OpenXml.Spreadsheet.Font();
            fontName = new FontName {
                Val = StringValue.FromString("Calibri")
            };
            fontSize = new FontSize {
                Val = DoubleValue.FromDouble(11)
            };
            font.Bold     = new Bold();
            font.FontName = fontName;
            font.FontSize = fontSize;
            fonts.Append(font);

            //Font Index 11 Body Normal
            font     = new DocumentFormat.OpenXml.Spreadsheet.Font();
            fontName = new FontName {
                Val = StringValue.FromString("Calibri")
            };
            fontSize = new FontSize {
                Val = DoubleValue.FromDouble(11)
            };
            font.FontName = fontName;
            font.FontSize = fontSize;
            fonts.Append(font);

            fonts.Count = UInt32Value.FromUInt32((uint)fonts.ChildElements.Count);
            #endregion

            #region Fills
            var fills = new Fills();

            //Fill index  0
            var fill        = new Fill();
            var patternFill = new PatternFill {
                PatternType = PatternValues.None
            };
            fill.PatternFill = patternFill;
            fills.Append(fill);

            //Fill index  1
            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.FromArgb(211, 211, 211));
            patternFill.BackgroundColor = new BackgroundColor {
                Rgb = patternFill.ForegroundColor.Rgb
            };
            fill.PatternFill = patternFill;
            fills.Append(fill);

            //Fill index  4
            fill        = new Fill();
            patternFill = new PatternFill {
                PatternType = PatternValues.Solid, ForegroundColor = new ForegroundColor()
            };
            patternFill.ForegroundColor = TranslateForeground(System.Drawing.Color.FromArgb(211, 211, 211));
            patternFill.BackgroundColor = new BackgroundColor()
            {
                Rgb = patternFill.ForegroundColor.Rgb
            };
            fill.PatternFill = patternFill;
            fills.Append(fill);

            //Fill index  5
            fill        = new Fill();
            patternFill = new PatternFill {
                PatternType = PatternValues.Solid, ForegroundColor = new ForegroundColor()
            };
            patternFill.ForegroundColor = TranslateForeground(System.Drawing.Color.FromArgb(245, 245, 245));
            patternFill.BackgroundColor = new BackgroundColor {
                Rgb = patternFill.ForegroundColor.Rgb
            };
            fill.PatternFill = patternFill;
            fills.Append(fill);

            //Fill index  6 ForeGround Header Blue
            fill        = new Fill();
            patternFill = new PatternFill {
                PatternType = PatternValues.Solid, ForegroundColor = new ForegroundColor()
            };
            patternFill.ForegroundColor = TranslateForeground(System.Drawing.Color.FromArgb(0, 176, 240));
            patternFill.BackgroundColor = new BackgroundColor {
                Rgb = patternFill.ForegroundColor.Rgb
            };

            fill.PatternFill = patternFill;
            fills.Append(fill);

            //Fill index  7 ForeGround Header green
            fill        = new Fill();
            patternFill = new PatternFill {
                PatternType = PatternValues.Solid, ForegroundColor = new ForegroundColor()
            };
            patternFill.ForegroundColor = TranslateForeground(System.Drawing.Color.FromArgb(146, 208, 80));
            patternFill.BackgroundColor = new BackgroundColor {
                Rgb = patternFill.ForegroundColor.Rgb
            };
            fill.PatternFill = patternFill;
            fills.Append(fill);

            fills.Count = UInt32Value.FromUInt32((uint)fills.ChildElements.Count);
            #endregion

            #region Borders
            var borders = new Borders();
            //All Boarder Index 0
            var border = new Border
            {
                LeftBorder = new LeftBorder {
                    Style = BorderStyleValues.Thin, Color = new Color()
                    {
                        Indexed = (UInt32Value)64U
                    }
                },
                RightBorder = new RightBorder {
                    Style = BorderStyleValues.Thin, Color = new Color()
                    {
                        Indexed = (UInt32Value)64U
                    }
                },
                TopBorder = new TopBorder {
                    Style = BorderStyleValues.Thin, Color = new Color()
                    {
                        Indexed = (UInt32Value)64U
                    }
                },
                BottomBorder = new BottomBorder {
                    Style = BorderStyleValues.Thin, Color = new Color()
                    {
                        Indexed = (UInt32Value)64U
                    }
                },
                DiagonalBorder = new DiagonalBorder()
            };
            borders.Append(border);

            //All Boarder Index 1
            border = new Border
            {
                LeftBorder = new LeftBorder {
                    Style = BorderStyleValues.Thin, Color = new Color()
                    {
                        Indexed = (UInt32Value)64U
                    }
                },
                RightBorder = new RightBorder {
                    Style = BorderStyleValues.Thin, Color = new Color()
                    {
                        Indexed = (UInt32Value)64U
                    }
                },
                TopBorder = new TopBorder {
                    Style = BorderStyleValues.Thin, Color = new Color()
                    {
                        Indexed = (UInt32Value)64U
                    }
                },
                BottomBorder = new BottomBorder {
                    Style = BorderStyleValues.Thin, Color = new Color()
                    {
                        Indexed = (UInt32Value)64U
                    }
                },
                DiagonalBorder = new DiagonalBorder()
            };
            borders.Append(border);
            //All Boarder Index 2
            border = new Border
            {
                LeftBorder = new LeftBorder {
                    Style = BorderStyleValues.Thin, Color = new Color()
                    {
                        Indexed = (UInt32Value)64U
                    }
                },
                RightBorder = new RightBorder {
                    Style = BorderStyleValues.Thin, Color = new Color()
                    {
                        Indexed = (UInt32Value)64U
                    }
                },
                TopBorder = new TopBorder {
                    Style = BorderStyleValues.Thin, Color = new Color()
                    {
                        Indexed = (UInt32Value)64U
                    }
                },
                BottomBorder = new BottomBorder {
                    Style = BorderStyleValues.Thin, Color = new Color()
                    {
                        Indexed = (UInt32Value)64U
                    }
                },
                DiagonalBorder = new DiagonalBorder()
            };
            borders.Append(border);
            borders.Count = UInt32Value.FromUInt32((uint)borders.ChildElements.Count);
            #endregion

            #region CellStyleFormats
            var cellStyleFormats = new CellStyleFormats();

            var cellFormat = new CellFormat {
                NumberFormatId = 0, FontId = 0, FillId = 0, BorderId = 1
            };
            cellStyleFormats.Append(cellFormat);

            cellFormat = new CellFormat {
                NumberFormatId = 0, FontId = 2, FillId = 4, BorderId = 1
            };
            cellStyleFormats.Append(cellFormat);

            cellStyleFormats.Count = UInt32Value.FromUInt32((uint)cellStyleFormats.ChildElements.Count);
            uint iExcelIndex = 164;

            #endregion

            #region NumberFormats
            var numberingFormats = new NumberingFormats();

            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);
            #endregion

            #region CellFormats
            var cellFormats = new CellFormats();

            // index 0
            cellFormat = new CellFormat
            {
                NumberFormatId = 0,
                FontId         = 0,
                FillId         = 0,
                FormatId       = 0
            };
            cellFormats.Append(cellFormat);

            // index 1
            // Cell Standard Date format
            cellFormat = new CellFormat
            {
                NumberFormatId    = 14,
                FontId            = 0,
                FillId            = 0,
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cellFormat.AppendChild(new Alignment {
                Vertical = VerticalAlignmentValues.Top
            });
            cellFormats.Append(cellFormat);
            // Index 2
            // Cell Standard Number format with 2 decimal placing
            cellFormat = new CellFormat
            {
                NumberFormatId    = 4,
                FontId            = 0,
                FillId            = 0,
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cellFormat.AppendChild(new Alignment {
                Vertical = VerticalAlignmentValues.Top
            });
            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          = 1,
                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          = 1,
                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          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cellFormats.Append(cellFormat);

            // index 12 for insight header
            cellFormat = new CellFormat
            {
                NumberFormatId = nformatForcedText.NumberFormatId,
                FontId         = 2,
                FillId         = 4,
                //BorderId = 1,
                FormatId          = 1,
                ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cellFormats.Append(cellFormat);

            // index 13
            cellFormat = new CellFormat
            {
                NumberFormatId    = nformatForcedText.NumberFormatId,
                FontId            = 0,
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cellFormat.AppendChild(new Alignment {
                Vertical = VerticalAlignmentValues.Top
            });
            cellFormats.Append(cellFormat);

            // index 14 alternate for index 1
            // Cell Standard Date format
            cellFormat = new CellFormat
            {
                NumberFormatId    = 14,
                FontId            = 0,
                FillId            = 5,
                BorderId          = 0,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cellFormat.AppendChild(new Alignment {
                Vertical = VerticalAlignmentValues.Top
            });
            cellFormats.Append(cellFormat);
            // Index 15  alternate for index 2
            // Cell Standard Number format with 2 decimal placing
            cellFormat = new CellFormat
            {
                NumberFormatId    = 4,
                FontId            = 0,
                FillId            = 5,
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cellFormat.AppendChild(new Alignment {
                Vertical = VerticalAlignmentValues.Top
            });
            cellFormats.Append(cellFormat);
            // index 16  alternate for index 13
            cellFormat = new CellFormat
            {
                NumberFormatId    = nformatForcedText.NumberFormatId,
                FontId            = 0,
                FillId            = 5,
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cellFormat.AppendChild(new Alignment {
                Vertical = VerticalAlignmentValues.Top
            });
            cellFormats.Append(cellFormat);
            // Index 17
            // Integer Cell format
            cellFormat = new CellFormat
            {
                FontId            = 0,
                FillId            = 0,
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cellFormat.AppendChild(new Alignment {
                Vertical = VerticalAlignmentValues.Top
            });
            cellFormats.Append(cellFormat);
            // Index 18
            // Integer Cell format alternate
            cellFormat = new CellFormat
            {
                FontId            = 0,
                FillId            = 5,
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cellFormat.AppendChild(new Alignment {
                Vertical = VerticalAlignmentValues.Top
            });
            cellFormats.Append(cellFormat);

            /*Style index for ITAreaList */
            // index 19  In-Progress
            cellFormat = new CellFormat
            {
                NumberFormatId    = nformatForcedText.NumberFormatId,
                FontId            = 4,
                FillId            = 0,//6
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cellFormats.Append(cellFormat);

            // index 20  Submitted
            cellFormat = new CellFormat
            {
                NumberFormatId    = nformatForcedText.NumberFormatId,
                FontId            = 5,
                FillId            = 0,//7
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cellFormats.Append(cellFormat);

            // index 21  Posted
            cellFormat = new CellFormat
            {
                NumberFormatId    = nformatForcedText.NumberFormatId,
                FontId            = 3,
                FillId            = 0,//8
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cellFormats.Append(cellFormat);

            // index 22  Accepted
            cellFormat = new CellFormat
            {
                NumberFormatId    = nformatForcedText.NumberFormatId,
                FontId            = 6,
                FillId            = 0,//9
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cellFormats.Append(cellFormat);
            /*Style index for ITAreaList */

            /*Style index for Dashboard */
            // Index 23
            cellFormat = new CellFormat
            {
                NumberFormatId    = nformatForcedText.NumberFormatId,
                FontId            = 7,
                FillId            = 4,
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cellFormats.Append(cellFormat);

            // Index 24
            cellFormat = new CellFormat
            {
                NumberFormatId    = nformatForcedText.NumberFormatId,
                FontId            = 8,
                FillId            = 4,
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cellFormat.AppendChild(new Alignment {
                Horizontal = HorizontalAlignmentValues.Right
            });
            cellFormats.Append(cellFormat);
            //cellFormat.ApplyAlignment = new BooleanValue(true);

            // Index 25
            cellFormat = new CellFormat
            {
                NumberFormatId    = nformatForcedText.NumberFormatId,
                FontId            = 7,
                FillId            = 0,
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cellFormats.Append(cellFormat);

            // Index 26
            cellFormat = new CellFormat
            {
                NumberFormatId    = nformatForcedText.NumberFormatId,
                FontId            = 7,
                FillId            = 0,
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true),
            };
            cellFormat.AppendChild(new Alignment {
                Horizontal = HorizontalAlignmentValues.Right
            });
            cellFormats.AppendChild(cellFormat);

            // index 27 for wrapText --AllComments
            cellFormat = new CellFormat
            {
                NumberFormatId    = nformatForcedText.NumberFormatId,
                FontId            = 0,
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cellFormat.AppendChild(new Alignment {
                WrapText = true
            });
            cellFormats.AppendChild(cellFormat);

            // index 28 for Alternate Wrap --AllComments
            cellFormat = new CellFormat
            {
                NumberFormatId    = nformatForcedText.NumberFormatId,
                FontId            = 0,
                FillId            = 5,
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cellFormat.AppendChild(new Alignment {
                WrapText = true
            });
            cellFormats.AppendChild(cellFormat);
            //cellFormat.ApplyAlignment = new BooleanValue(true);

            // index 29 for Alternate Wrap --AllComments
            cellFormat = new CellFormat
            {
                NumberFormatId    = nformatForcedText.NumberFormatId,
                FontId            = 0,
                FillId            = 0,
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true),
            };
            cellFormat.AppendChild(new Alignment {
                Horizontal = HorizontalAlignmentValues.Right
            });
            cellFormats.AppendChild(cellFormat);

            // Index 30
            // Coloured cell text without border
            cellFormat = new CellFormat
            {
                NumberFormatId    = nformatForcedText.NumberFormatId,
                FontId            = 1,
                FillId            = 3,
                BorderId          = 0,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cellFormats.Append(cellFormat);

            // Index 31
            // Coloured cell text without border right aligned
            cellFormat = new CellFormat
            {
                NumberFormatId    = nformatForcedText.NumberFormatId,
                FontId            = 1,
                FillId            = 3,
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true),
                Alignment         = new Alignment {
                    Horizontal = HorizontalAlignmentValues.Right, Vertical = VerticalAlignmentValues.Top
                }
            };
            cellFormats.AppendChild(cellFormat);

            // index 32
            cellFormat = new CellFormat
            {
                NumberFormatId    = nformatForcedText.NumberFormatId,
                FontId            = 0,
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true),
                Alignment         = new Alignment {
                    Horizontal = HorizontalAlignmentValues.Right, Vertical = VerticalAlignmentValues.Top
                }
            };
            cellFormats.Append(cellFormat);

            // index 33  alternate for index 32
            cellFormat = new CellFormat
            {
                NumberFormatId    = nformatForcedText.NumberFormatId,
                FontId            = 0,
                FillId            = 5,
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true),
                Alignment         = new Alignment {
                    Horizontal = HorizontalAlignmentValues.Right, Vertical = VerticalAlignmentValues.Top
                }
            };
            cellFormats.Append(cellFormat);

            // index 34  date format 17 = 'mmm-yy'
            cellFormat = new CellFormat
            {
                NumberFormatId    = 17,
                FontId            = 1,
                FillId            = 3,
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true),
                Alignment         = new Alignment {
                    Horizontal = HorizontalAlignmentValues.Right, Vertical = VerticalAlignmentValues.Top
                }
            };
            cellFormats.Append(cellFormat);

            // index 35
            // Cell Standard date format 17 = 'mmm-yy'
            cellFormat = new CellFormat
            {
                NumberFormatId    = 17,
                FontId            = 0,
                FillId            = 0,
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true),
                Alignment         = new Alignment {
                    Horizontal = HorizontalAlignmentValues.Right, Vertical = VerticalAlignmentValues.Top
                }
            };
            cellFormats.Append(cellFormat);

            // index 36 alternate for index 35
            // Cell Standard date format 17 = 'mmm-yy'
            cellFormat = new CellFormat
            {
                NumberFormatId    = 17,
                FontId            = 0,
                FillId            = 5,
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true),
                Alignment         = new Alignment {
                    Horizontal = HorizontalAlignmentValues.Right, Vertical = VerticalAlignmentValues.Top
                }
            };
            cellFormats.Append(cellFormat);

            // Index 37
            // Coloured cell text for Excel Header
            cellFormat = new CellFormat
            {
                NumberFormatId    = nformatForcedText.NumberFormatId,
                FontId            = 2,
                FillId            = 3,
                BorderId          = 0,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cellFormats.Append(cellFormat);


            // Index 38
            // Bold text Cell - Left Align
            cellFormat = new CellFormat
            {
                NumberFormatId    = nformatForcedText.NumberFormatId,
                FontId            = 1,
                FillId            = 0,
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true)
            };
            cellFormats.Append(cellFormat);

            // Index 39
            // Bold text Cell with background - Center Align
            cellFormat = new CellFormat
            {
                NumberFormatId    = nformatForcedText.NumberFormatId,
                FontId            = 1,
                FillId            = 3,
                BorderId          = 2,
                FormatId          = 0,
                ApplyBorder       = true,
                ApplyNumberFormat = BooleanValue.FromBoolean(true),
                Alignment         = new Alignment {
                    Horizontal = HorizontalAlignmentValues.Center
                }
            };
            cellFormats.Append(cellFormat);

            // Index 40
            // Bold text Cell - Right Align
            cellFormat = new CellFormat
            {
                NumberFormatId    = 4,
                FontId            = 1,
                FillId            = 0,
                BorderId          = 1,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true),
                Alignment         = new Alignment {
                    Horizontal = HorizontalAlignmentValues.Right
                }
            };
            cellFormats.Append(cellFormat);

            /* End Style index for Dashboard */

            // Fonts For Tax Savings
            // Index 41 For Header
            cellFormat = new CellFormat
            {
                NumberFormatId    = 0,
                FontId            = 9,
                FillId            = 6,
                BorderId          = 0,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true),
                Alignment         = new Alignment {
                    Horizontal = HorizontalAlignmentValues.Left
                }
            };
            cellFormats.Append(cellFormat);

            // Index 42 For Header
            cellFormat = new CellFormat
            {
                NumberFormatId    = 0,
                FontId            = 10,
                FillId            = 7,
                BorderId          = 0,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true),
                Alignment         = new Alignment {
                    Horizontal = HorizontalAlignmentValues.Left
                }
            };
            cellFormats.Append(cellFormat);

            // Index 43 For Body Header Bold
            cellFormat = new CellFormat
            {
                NumberFormatId    = 0,
                FontId            = 10,
                FillId            = 0,
                BorderId          = 0,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true),
                Alignment         = new Alignment {
                    Horizontal = HorizontalAlignmentValues.Center
                }
            };
            cellFormats.Append(cellFormat);

            // Index 44 For Body Header Normal
            cellFormat = new CellFormat
            {
                NumberFormatId    = 0,
                FontId            = 11,
                FillId            = 0,
                BorderId          = 0,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true),
                Alignment         = new Alignment {
                    Horizontal = HorizontalAlignmentValues.Left
                }
            };
            cellFormats.Append(cellFormat);

            // Index 45 For Body Cell Float
            cellFormat = new CellFormat
            {
                NumberFormatId    = 4,
                FontId            = 11,
                FillId            = 0,
                BorderId          = 0,
                FormatId          = 0,
                ApplyNumberFormat = BooleanValue.FromBoolean(true),
                Alignment         = new Alignment {
                    Horizontal = HorizontalAlignmentValues.Right
                }
            };
            cellFormats.Append(cellFormat);

            numberingFormats.Count = UInt32Value.FromUInt32((uint)numberingFormats.ChildElements.Count);
            cellFormats.Count      = UInt32Value.FromUInt32((uint)cellFormats.ChildElements.Count);
            #endregion

            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);
        }
Beispiel #45
0
        /// <summary>
        /// Generates Styles for Workbook.
        /// </summary>
        /// <param name="workbookStylesPart">Workbook Style Part to add styles to</param>
        private void GenerateWorkbookStylesPart1Content(WorkbookStylesPart 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 = 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 = 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);


            CellFormats cellFormats1 = new CellFormats {
                Count = 2U
            };
            CellFormat cellFormat2 = new CellFormat {
                NumberFormatId = 0U, FontId = 0U, FillId = 0U, BorderId = 0U, FormatId = 0U
            };

            CellFormat cellFormat3 = new CellFormat {
                NumberFormatId = 0U, FontId = 0U, FillId = 0U, BorderId = 0U, FormatId = 0U, ApplyAlignment = true
            };
            Alignment alignment1 = new Alignment {
                Horizontal = HorizontalAlignmentValues.Center
            };

            cellFormat3.Append(alignment1);

            cellFormats1.Append(cellFormat2);
            cellFormats1.Append(cellFormat3);

            DifferentialFormats differentialFormats1 = new DifferentialFormats {
                Count = 4U
            };

            DifferentialFormat differentialFormat1 = new DifferentialFormat();
            Alignment          alignment2          = new Alignment {
                Horizontal      = HorizontalAlignmentValues.Center,
                Vertical        = VerticalAlignmentValues.Bottom,
                TextRotation    = 0U,
                WrapText        = false,
                Indent          = 0U,
                JustifyLastLine = false,
                ShrinkToFit     = false,
                ReadingOrder    = 0U
            };

            differentialFormat1.Append(alignment2);

            DifferentialFormat differentialFormat2 = new DifferentialFormat();
            Alignment          alignment3          = new Alignment {
                Horizontal      = HorizontalAlignmentValues.Center,
                Vertical        = VerticalAlignmentValues.Bottom,
                TextRotation    = 0U,
                WrapText        = false,
                Indent          = 0U,
                JustifyLastLine = false,
                ShrinkToFit     = false,
                ReadingOrder    = 0U
            };

            differentialFormat2.Append(alignment3);

            DifferentialFormat differentialFormat3 = new DifferentialFormat();
            Alignment          alignment4          = new Alignment {
                Horizontal      = HorizontalAlignmentValues.Center,
                Vertical        = VerticalAlignmentValues.Bottom,
                TextRotation    = 0U,
                WrapText        = false,
                Indent          = 0U,
                JustifyLastLine = false,
                ShrinkToFit     = false,
                ReadingOrder    = 0U
            };

            differentialFormat3.Append(alignment4);

            DifferentialFormat differentialFormat4 = new DifferentialFormat();
            Alignment          alignment5          = new Alignment {
                Horizontal      = HorizontalAlignmentValues.Center,
                Vertical        = VerticalAlignmentValues.Bottom,
                TextRotation    = 0U,
                WrapText        = false,
                Indent          = 0U,
                JustifyLastLine = false,
                ShrinkToFit     = false,
                ReadingOrder    = 0U
            };

            differentialFormat4.Append(alignment5);

            differentialFormats1.Append(differentialFormat1);
            differentialFormats1.Append(differentialFormat2);
            differentialFormats1.Append(differentialFormat3);
            differentialFormats1.Append(differentialFormat4);

            stylesheet1.Append(fonts1);
            stylesheet1.Append(fills1);
            stylesheet1.Append(borders1);
            stylesheet1.Append(cellFormats1);
            stylesheet1.Append(differentialFormats1);

            workbookStylesPart.Stylesheet = stylesheet1;
        }
        private static 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
            };

            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();
            Bold     bold1     = new Bold();
            FontSize fontSize2 = new FontSize()
            {
                Val = 11D
            };
            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(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
            };
            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()
            {
                Style = BorderStyleValues.Thin
            };
            Color color6 = new 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;
        }
Beispiel #47
0
        /// <summary>
        /// Создает стилевую составляющую документа
        /// </summary>
        /// <param name="workbookStylesPart">Стилевая часть книги</param>
        private void GenerateStyles(WorkbookStylesPart workbookStylesPart)
        {
            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");

            #region Fonts
            Fonts fonts = new Fonts()
            {
                Count      = 1U,
                KnownFonts = true
            };
            Font     font     = new Font();
            FontSize fontSize = new FontSize()
            {
                Val = 11D
            };
            Color color1 = new Color()
            {
                Theme = 1U
            };
            FontName fontName = new FontName()
            {
                Val = "Calibri"
            };
            FontFamilyNumbering fontFamilyNumbering = new FontFamilyNumbering()
            {
                Val = 2
            };
            FontCharSet fontCharSet = new FontCharSet()
            {
                Val = 204
            };
            FontScheme fontScheme = new FontScheme()
            {
                Val = FontSchemeValues.Minor
            };

            font.Append(fontSize);
            font.Append(color1);
            font.Append(fontName);
            font.Append(fontFamilyNumbering);
            font.Append(fontCharSet);
            font.Append(fontScheme);

            fonts.Append(font);
            #endregion

            #region Fills
            Fills fills = new Fills()
            {
                Count = 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);

            fills.Append(fill1);
            fills.Append(fill2);
            #endregion

            #region Borders
            Borders borders = new Borders()
            {
                Count = 1U
            };

            Border         border1         = new Border();
            LeftBorder     leftBorder1     = new LeftBorder();
            RightBorder    rightBorder1    = new RightBorder();
            TopBorder      topBorder1      = new TopBorder();
            BottomBorder   bottomBorder    = new BottomBorder();
            DiagonalBorder diagonalBorder1 = new DiagonalBorder();

            border1.Append(leftBorder1);
            border1.Append(rightBorder1);
            border1.Append(topBorder1);
            border1.Append(bottomBorder);
            border1.Append(diagonalBorder1);

            borders.Append(border1);
            #endregion

            #region Cell Styles And Formats
            CellStyleFormats cellStyleFormats = new CellStyleFormats()
            {
                Count = 1U
            };
            CellFormat cellFormat1 = new CellFormat()
            {
                NumberFormatId = 0U,
                FontId         = 0U,
                FillId         = 0U,
                BorderId       = 0U
            };
            cellStyleFormats.Append(cellFormat1);

            CellFormats cellFormats = new CellFormats()
            {
                Count = 1U
            };
            CellFormat cellFormat2 = new CellFormat()
            {
                NumberFormatId = 0U,
                FontId         = 0U,
                FillId         = 0U,
                BorderId       = 0U,
                FormatId       = 0U
            };

            cellFormats.Append(cellFormat2);

            CellStyles cellStyles = new CellStyles()
            {
                Count = 1U
            };
            CellStyle cellStyle = new CellStyle()
            {
                Name      = "Обычный",
                FormatId  = 0U,
                BuiltinId = 0U
            };
            cellStyles.Append(cellStyle);
            #endregion

            DifferentialFormats differentialFormats = new DifferentialFormats()
            {
                Count = 0U
            };
            TableStyles tableStyles = new TableStyles()
            {
                Count             = 0U,
                DefaultTableStyle = "TableStyleMedium2",
                DefaultPivotStyle = "PivotStyleLight16"
            };

            #region Stylesheet Extensions
            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");
            X14.SlicerStyles slicerStyles = new X14.SlicerStyles()
            {
                DefaultSlicerStyle = "SlicerStyleLight1"
            };
            stylesheetExtension1.Append(slicerStyles);

            StylesheetExtension stylesheetExtension2 = new StylesheetExtension()
            {
                Uri = "{9260A510-F301-46a8-8635-F512D64BE5F5}"
            };
            stylesheetExtension2.AddNamespaceDeclaration("x15",
                                                         "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main");

            OpenXmlUnknownElement unknownElement =
                OpenXmlUnknownElement.CreateOpenXmlUnknownElement(
                    "<x15:timelineStyles defaultTimelineStyle=\"TimeSlicerStyleLight1\" xmlns:x15=\"http://schemas.microsoft.com/office/spreadsheetml/2010/11/main\" />");
            stylesheetExtension2.Append(unknownElement);

            stylesheetExtensionList.Append(stylesheetExtension1);
            stylesheetExtensionList.Append(stylesheetExtension2);
            #endregion

            stylesheet.Append(fonts);
            stylesheet.Append(fills);
            stylesheet.Append(borders);
            stylesheet.Append(cellStyleFormats);
            stylesheet.Append(cellFormats);
            stylesheet.Append(cellStyles);
            stylesheet.Append(differentialFormats);
            stylesheet.Append(tableStyles);
            stylesheet.Append(stylesheetExtensionList);

            workbookStylesPart.Stylesheet = stylesheet;
        }
        public CustomStylesheet()
        {
            NumberStyles = new Dictionary<NumberStyle, NumberingFormat>();
            CellFormatStyles = new Dictionary<CellFormatId, uint>();

            Borders = new Borders();
            BorderStyles = new Dictionary<string, uint>();

            Fonts = new Fonts();
            FontStyles = new Dictionary<string, uint>();

            RegisterBorder("None");
            RegisterFont("Default", new Font
            {
             				FontName = new FontName { Val = StringValue.FromString("Calibri") },
                FontSize = new FontSize { Val = DoubleValue.FromDouble(10) }
            });

            var fills = CreateFills();

            var numberingFormats = CreateNumberFormats();

            MyCellFormats = new DocumentFormat.OpenXml.Spreadsheet.CellFormats();
            MyCellFormats.Append(new CellFormat
            {
                NumberFormatId = 0,
                FontId = 0,
                FillId = 0,
                BorderId = 0,
                FormatId = 0
            });

            //BuildCellFormat(BorderStyle.All, NumberStyle.ForcedText);

            var cellStyleFormats = new CellStyleFormats();

            var cellFormat = new CellFormat
            {
                Alignment = new Alignment() { Horizontal = HorizontalAlignmentValues.Center },
                NumberFormatId = 0,
                FontId = 0,
                FillId = 0,
                BorderId = 0
            };
            cellStyleFormats.Append(cellFormat);
            cellStyleFormats.Count =
                 UInt32Value.FromUInt32((uint)cellStyleFormats.ChildElements.Count);

            //var cellFormats = CreateCellFormats();

            this.Append(numberingFormats);
            this.Append(Fonts);	//	OK
            this.Append(fills);
            this.Append(Borders);	//	OK
            this.Append(cellStyleFormats);
            this.Append(MyCellFormats);
            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);
        }
Beispiel #49
0
        private int SetStyle <T>(T style) where T : class
        {
            UInt32 index = 0;

            if (style is Font)
            {
                Fonts fonts = this.style_part.Stylesheet.GetFirstChild <Fonts>();
                if (fonts == null)
                {
                    fonts = new Fonts()
                    {
                        KnownFonts = true
                    };
                    this.style_part.Stylesheet.Append(fonts);
                }

                fonts.Append(style as Font);
                fonts.Count = (UInt32)fonts.ChildElements.Count;

                index = fonts.Count - 1;
            }
            else if (style is Fill)
            {
                Fills fills = this.style_part.Stylesheet.GetFirstChild <Fills>();
                if (fills == null)
                {
                    fills = new Fills();
                    this.style_part.Stylesheet.Append(fills);
                }

                fills.Append(style as Fill);
                fills.Count = (UInt32)fills.ChildElements.Count;

                index = fills.Count - 1;
            }
            else if (style is Border)
            {
                Borders borders = this.style_part.Stylesheet.GetFirstChild <Borders>();
                if (borders == null)
                {
                    borders = new Borders();
                    this.style_part.Stylesheet.Append(borders);
                }

                borders.Append(style as Border);
                borders.Count = (UInt32)borders.ChildElements.Count;

                index = borders.Count - 1;
            }
            else if (style is CellFormat)
            {
                CellFormats formats = this.style_part.Stylesheet.GetFirstChild <CellFormats>();
                if (formats == null)
                {
                    formats = new CellFormats();
                    this.style_part.Stylesheet.Append(formats);
                }

                formats.Append(style as CellFormat);
                formats.Count = (UInt32)formats.ChildElements.Count;

                index = formats.Count - 1;
            }
            else if (style is NumberingFormat)
            {
                //0 = 'General';
                //1 = '0';
                //2 = '0.00';
                //3 = '#,##0';
                //4 = '#,##0.00';

                //9 = '0%';
                //10 = '0.00%';
                //11 = '0.00E+00';
                //12 = '# ?/?';
                //13 = '# ??/??';
                //14 = 'mm-dd-yy';
                //15 = 'd-mmm-yy';
                //16 = 'd-mmm';
                //17 = 'mmm-yy';
                //18 = 'h:mm AM/PM';
                //19 = 'h:mm:ss AM/PM';
                //20 = 'h:mm';
                //21 = 'h:mm:ss';
                //22 = 'm/d/yy h:mm';

                //37 = '#,##0 ;(#,##0)';
                //38 = '#,##0 ;[Red](#,##0)';
                //39 = '#,##0.00;(#,##0.00)';
                //40 = '#,##0.00;[Red](#,##0.00)';

                //44 = '_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)';
                //45 = 'mm:ss';
                //46 = '[h]:mm:ss';
                //47 = 'mmss.0';
                //48 = '##0.0E+0';
                //49 = '@';

                //27 = '[$-404]e/m/d';
                //30 = 'm/d/yy';
                //36 = '[$-404]e/m/d';
                //50 = '[$-404]e/m/d';
                //57 = '[$-404]e/m/d';

                //59 = 't0';
                //60 = 't0.00';
                //61 = 't#,##0';
                //62 = 't#,##0.00';
                //67 = 't0%';
                //68 = 't0.00%';
                //69 = 't# ?/?';
                //70 = 't# ??/??';

                NumberingFormats formats = this.style_part.Stylesheet.GetFirstChild <NumberingFormats>();
                if (formats == null)
                {
                    formats = new NumberingFormats();
                    this.style_part.Stylesheet.Append(formats);
                }
                NumberingFormat format = style as NumberingFormat;
                if (format != null)
                {
                    format.NumberFormatId = customNumberingFormatIndex;
                    customNumberingFormatIndex++;

                    formats.Append(format);
                    formats.Count = (UInt32)formats.ChildElements.Count;

                    index = format.NumberFormatId;
                }
                else
                {
                    index = 0;
                }
            }
            else if (style is DifferentialFormat)
            {
                DifferentialFormats formats = this.style_part.Stylesheet.GetFirstChild <DifferentialFormats>();
                if (formats == null)
                {
                    formats = new DifferentialFormats();
                    this.style_part.Stylesheet.Append(formats);
                }

                formats.Append(style as DifferentialFormat);
                formats.Count = (UInt32)formats.ChildElements.Count;

                index = formats.Count - 1;
            }

            return(int.Parse(index.ToString()));
        }