EvotecIT / OfficeIMO

Fast and easy to use cross-platform .NET library that creates or modifies Microsoft Word (DocX) and later also Excel (XLSX) files without installing any software. Library is based on Open XML SDK
MIT License
288 stars 50 forks source link

Add a Table Cell Fill #32

Closed PrzemyslawKlys closed 2 years ago

PrzemyslawKlys commented 2 years ago
using DocumentFormat.OpenXml.Wordprocessing;
using DocumentFormat.OpenXml;

namespace GeneratedCode
{
    public class GeneratedClass
    {
        // Creates an TableCell instance and adds its children.
        public TableCell GenerateTableCell()
        {
            TableCell tableCell1 = new TableCell();

            TableCellProperties tableCellProperties1 = new TableCellProperties();
            TableCellWidth tableCellWidth1 = new TableCellWidth(){ Width = "3116", Type = TableWidthUnitValues.Dxa };
            Shading shading1 = new Shading(){ Val = ShadingPatternValues.Clear, Color = "auto", Fill = "4472C4", ThemeFill = ThemeColorValues.Accent1 };

            tableCellProperties1.Append(tableCellWidth1);
            tableCellProperties1.Append(shading1);
            Paragraph paragraph1 = new Paragraph(){ RsidParagraphAddition = "001F2E94", RsidRunAdditionDefault = "001F2E94", ParagraphId = "037BA2FD", TextId = "77777777" };

            tableCell1.Append(tableCellProperties1);
            tableCell1.Append(paragraph1);
            return tableCell1;
        }

    }
}