How to change the Tab color.

Home Forums Open-Xml-Sdk How to change the Tab color.

This topic contains 0 replies, has 1 voice, and was last updated by  madhav 7 years, 11 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #3343

    madhav
    Participant

    Using OPENXML sdk and SpreadsheetDocument ,I have created a complete new Excel sheet. But I am not able to set the color of tabs of Excel sheet.

    Please suggest any solution on priority.

    internal ExcelPackage(Stream inSaveStream, Workbook.Workbook wb)
    {
    //main package parts
    _saveStream = inSaveStream;
    _internalStream = new MemoryStream();
    _package = SpreadsheetDocument.Create(_internalStream, SpreadsheetDocumentType.Workbook);
    _corePart = new ExcelPackagePart<CoreFilePropertiesPart>(_package.AddCoreFilePropertiesPart());
    //_appPart = new ExcelPackagePart<ExtendedFilePropertiesPart>(_package.AddExtendedFilePropertiesPart());

    //workbook parts
    _workbookPart = new ExcelPackagePart<WorkbookPart>(_package.AddWorkbookPart());
    _stylesPart = new ExcelPackagePart<WorkbookStylesPart>(_workbookPart.Part.AddNewPart<WorkbookStylesPart>());
    _sheetParts = new List<ExcelPackagePart<WorksheetPart>>(15);
    _drawingsParts = new List<ExcelPackagePart<DrawingsPart>>(15);
    _commentsParts = new List<ExcelPackagePart<WorksheetCommentsPart>>(15);
    _vmlDrawingsParts = new List<ExcelPackagePart<VmlDrawingPart>>(15);
    _collectionHandler = new CollectionBucket(this);

    CellStyle cs = new CellStyle();
    cs.Font = wb.DefaultFontStyle;
    cs.Fill.Pattern = StyleFillOption.none;
    cs.Borders.PreWriteXml(this);
    cs.Fill.PreWriteXml(this);
    cs.PreWriteXml(this);

    //these style fills must be written because excel requires that the first two style fills
    //be none and gray125.
    StyleFill sf = new StyleFill();
    sf.Pattern = StyleFillOption.gray125;
    sf.PreWriteXml(this);
    }

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.