Exemplo n.º 1
0
        static TableCell CreateTextCell(string text,RunProperties runProperties, params System.Drawing.Color[] color)
        {
            try
            {
                Repository.Utility.WriteLog("CreateTextCell started ", System.Diagnostics.EventLogEntryType.Information);
                TableCellProperties tableCellProperty = new TableCellProperties();
                if (color.Length > 0)
                {

                    SolidFill solidFill1 = new SolidFill();
                    RgbColorModelHex rgbColorModelHex1 = new RgbColorModelHex() { Val = color[0].ToHexString() };
                    solidFill1.Append(rgbColorModelHex1);
                    tableCellProperty.Append(solidFill1);
                }
                TableCell tc = new TableCell(
                new TextBody(
                new BodyProperties(),
                new Paragraph(
                new Run(
                runProperties.Clone() as RunProperties,
                new Text(text)))),
                tableCellProperty);
                Repository.Utility.WriteLog("CreateTextCell completed successfully ", System.Diagnostics.EventLogEntryType.Information);
                return tc;
            }
            catch
            {
                return new TableCell();
            }
        }