Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
private void StylizeHeaderCharacters(Workbook wb, Worksheet ws)
{
    Palette pal = wb.Palette;

    //--- Get a reference to cell A1
    Cell cellHeader = ws[0, 0];

    //--- By using SetColorAt, we ensure that the colors that
    //--- are returned are part of the legacy palette. We need
    //--- to use separate palette indices for each color we want
    //--- in the workbook, limiting us to 56 colors.
    Color clrDarkBlue = pal.SetColorAt(0, 0, 0, 255);
    Color clrDarkGreen = pal.SetColorAt(1, 51, 153, 102);

    //--- Stylize the first word, starting from the
    //--- first character, ending at the 10th
    cellHeader.GetCharacters(0, 10).Font.Size = 12;

    //--- Format the font for the next two words in the cell
    cellHeader.GetCharacters(11, 12).Font.Color = clrDarkBlue;
    cellHeader.GetCharacters(24, 12).Font.Color = clrDarkGreen;
}
Scrollbar