1betvictor1946.插入报表

以上是自家使用Free
Spire.Presentation那款组件对PPT文书档案中表格的有的操作,希望能提供增派,谢谢阅读!

手续一:开始化三个Presentation实例并加载贰个PowerPoint文书档案

Presentation ppt = new Presentation();
ppt.LoadFromFile(@"C:\Users\Administrator\Desktop\创建表格.pptx");
string[,] data = new string[,]
{
    {"排名","姓名","销售额","回款额","工号"},
    {"1","李彪","18270","18270","0011"},
    {"2","李娜","18105","18105","0025"},
    {"3","张丽","17987","17987","0008"},
    {"4","黄艳","17790","17790","0017"},
};
ppt.SaveToFile("创建表格.pptx", FileFormat.Pptx2010);

步骤二:获取第一张幻灯片上的报表

手续四:注解并先河化七个String[,]数组

 

步骤一:初叶化三个Presentation实例并加载三个PowerPoint文书档案

for (int i = 0; i < 5; i++)
{
    for (int j = 0; j < 5; j++)
    {
        table[j, i].TextFrame.Text = data[i, j];
        table[j, i].TextFrame.Paragraphs[0].TextRanges[0].LatinFont = new TextFont("Arial");
    }
}

步骤四:保存文书档案

今世深造和办公室其中,经常会接触到对表格的行使,像各样单据、报表、账户等等。在PPT演示文稿中同样不可制止的使用到各类数码表格。对于在PPT中插入表格,小编发觉了七个新方式,不过本身利用了一款无需付费的.NET组件——Free
Spire.Presentation,在C#中增加该产品DLL文件,能够轻巧便捷地贯彻对示范文稿的报表插入、编辑和删除等操作。有要求的话能够在底下的网站下载:https://www.e-iceblue.cn/Downloads/Free-Spire-Presentation-NET.html

2.去除表格行与列

ppt.SaveToFile("删除行与列.pptx", FileFormat.Pptx2010);

1.插入报表

手续三:为表格设置内置格式

for (int i = 0; i < 5; i++)
{
    for (int j = 0; j < 5; j++)
    {
        table[j, i].TextFrame.Text = data[i, j];
        table[j, i].TextFrame.Paragraphs[0].TextRanges[0].LatinFont = new TextFont("Arial");
    }
}

betvictor1946 1

double[] widths = new double[] { 100, 100, 100, 100, 100 };
double[] heights = new double[] { 15, 15, 15, 15, 15 };
ITable table = ppt.Slides[0].Shapes.AppendTable(80, 80, widths, heights);

3.删减表格

手续五:保存文书档案

变成操作后获得以下PPT文书档案效果

betvictor1946 2

步骤二:开首化贰个List对象,成分类型为IShape

手续三:删除第四列及第四行

Presentation ppt = new Presentation();
ppt.SlideSize.Type = SlideSizeType.Screen16x9;
table.StylePreset = TableStylePreset.LightStyle1Accent2;
ppt.Slides[0].Shapes.Remove(tableShapes[0]);

手续四:从幻灯片删除首个表格图形

ppt.SaveToFile("删除表格.pptx", FileFormat.Pptx2010);

 

List<IShape> tableShapes = new List<IShape>();

步骤六:保存文书档案

table.ColumnsList.RemoveAt(3, false);
table.TableRows.RemoveAt(4, false);

步骤二:初步化三个ITable实例,并钦命地点、行数和列数、行高和列宽

步骤三:获取第一张幻灯片上保有的报表图形并增添到List

Presentation ppt = new Presentation();
ppt.LoadFromFile(@"C:\Users\Administrator\Desktop\创建表格.pptx");

步骤一:创立三个PowerPoint文书档案

相关文章