表标题列的背景颜色未更改

潘卡

我在项目中使用ASPOSE幻灯片执行PPT任务。我想更改表格标题的background-color,但在Aspose论坛中找不到任何解决方案。有人可以为我提供解决方案吗?

            ISlide sld = press.Slides[0];
            double[] dblCols = { 250, 250};
            double[] dblRows = { 70, 70, 70,70 };
            // Add table shape to slide
            ITable tbl = sld.Shapes.AddTable(100, 100, dblCols, dblRows);
            tbl[0, 1].TextFrame.Text = "some text";
            tbl[0, 2].TextFrame.Text = "some text";
            tbl[0, 3].TextFrame.Text = "some text";
            tbl[0, 3].BorderBottom.FillFormat.FillType = FillType.Solid;
            tbl[0, 3].FillFormat.SolidFillColor.BackgroundColor = Color.Blue;
            tbl[0,3].BorderBottom.Width = 2;

            Portion portion = (Portion)tbl[0, 1].TextFrame.Paragraphs[0].Portions[0];
            portion.PortionFormat.FillFormat.FillType = FillType.Solid;
            portion.PortionFormat.FillFormat.SolidFillColor.Color = Color.Black;

}

穆达西尔

@pankaj,

我观察到您与设置表标题背景有关的要求。请尝试使用以下示例代码,该示例代码具有为标题行单元格之一设置填充颜色的示例。您也可以为其他单元复制相同的内容。

    public static void TestTableBackground()
    {
        Presentation press = new Presentation();
        ISlide sld = press.Slides[0];
        double[] dblCols = { 250, 250 };
        double[] dblRows = { 70, 70, 70, 70 };
        // Add table shape to slide
        ITable tbl = sld.Shapes.AddTable(100, 100, dblCols, dblRows);
        tbl[0, 1].TextFrame.Text = "some text";
        tbl[0, 2].TextFrame.Text = "some text";
        tbl[0, 3].TextFrame.Text = "some text";
        tbl[0, 0].FillFormat.FillType = FillType.Solid;
        tbl[0, 0].FillFormat.SolidFillColor.Color = Color.Blue;

        Portion portion = (Portion)tbl[0, 1].TextFrame.Paragraphs[0].Portions[0];
        portion.PortionFormat.FillFormat.FillType = FillType.Solid;
        portion.PortionFormat.FillFormat.SolidFillColor.Color = Color.Black;

        press.Save(@"C:\Aspose Data\TableFormat.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
    }

我在Aspose担任技术支持/开发人员。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章