static void FormatTable(Workbook workbook)
        {
            #region #FormatTable
            Worksheet worksheet = workbook.Worksheets["FormatTable"];
            workbook.Worksheets.ActiveWorksheet = worksheet;

            // Access a table.
            Table table = worksheet.Tables[0];

            // Access the workbook's collection of table styles.
            TableStyleCollection tableStyles = workbook.TableStyles;

            // Access the built-in table style by its name.
            TableStyle tableStyle = tableStyles[BuiltInTableStyleId.TableStyleMedium16];

            // Apply the style to the table.
            table.Style = tableStyle;

            // Show header and total rows.
            table.ShowHeaders = true;
            table.ShowTotals  = true;

            // Enable banded column formatting for the table.
            table.ShowTableStyleRowStripes    = false;
            table.ShowTableStyleColumnStripes = true;

            // Format the first column in the table.
            table.ShowTableStyleFirstColumn = true;
            worksheet.Visible = true;
            #endregion #FormatTable
        }
示例#2
0
 internal HtmlDocumentStyle(MainDocumentPart mainPart)
 {
     PrepareStyles(mainPart);
     tableStyle           = new TableStyleCollection(this);
     runStyle             = new RunStyleCollection(this);
     paraStyle            = new ParagraphStyleCollection(this);
     this.QuoteCharacters = QuoteChars.IE;
     this.mainPart        = mainPart;
 }
示例#3
0
 static void FormatTable(IWorkbook workbook)
 {
     #region #FormatTable
     Worksheet worksheet = workbook.Worksheets["FormatTable"];
     workbook.Worksheets.ActiveWorksheet = worksheet;
     Table table = worksheet.Tables[0];
     TableStyleCollection tableStyles = workbook.TableStyles;
     TableStyle           tableStyle  = tableStyles[BuiltInTableStyleId.TableStyleMedium21];
     table.Style       = tableStyle;
     table.ShowHeaders = true;
     table.ShowTotals  = true;
     table.ShowTableStyleRowStripes    = false;
     table.ShowTableStyleColumnStripes = true;
     table.ShowTableStyleFirstColumn   = true;
     worksheet.Visible = true;
     #endregion #FormatTable
 }
        void ApplyBuiltInTableStyle(IWorkbook workbook, Table table, string styleName)
        {
            // Access the workbook's collection of table styles.
            TableStyleCollection tableStyles = workbook.TableStyles;

            // Access the built-in table style from the collection by its name.
            TableStyle tableStyle = tableStyles[styleName];

            // Apply the table style to the existing table.
            table.Style = tableStyle;

            // Show header and total rows.
            table.ShowHeaders = true;
            table.ShowTotals  = true;

            // Apply banded column formatting to the table.
            table.ShowTableStyleRowStripes    = false;
            table.ShowTableStyleColumnStripes = true;
        }
        void ApplyInitialBuiltInTableStyle()
        {
            #region #ApplyInitialBuiltInTableStyle
            spreadsheetControl1.BeginUpdate();
            // Access the workbook's collection of table styles.
            TableStyleCollection tableStyles = spreadsheetControl1.Document.TableStyles;
            // Access the built-in table style from the collection by its Id.
            TableStyle tableStyle = tableStyles[BuiltInTableStyleId.TableStyleDark9];

            // Apply the table style to the existing table.
            Table myTable = spreadsheetControl1.ActiveWorksheet.Tables[0];
            myTable.Style = tableStyle;

            // Show header and total rows.
            myTable.ShowHeaders = true;
            myTable.ShowTotals  = true;
            // Apply banded column formatting to the table.
            myTable.ShowTableStyleRowStripes    = false;
            myTable.ShowTableStyleColumnStripes = true;

            spreadsheetControl1.EndUpdate();
            #endregion #ApplyInitialBuiltInTableStyle
        }