Pptx中图表文本内容读取


#1

如何通过aspose控件获取pptx中图表中绑定的文本内容,例如上传压缩包中pptx文件中红色部分CpatureText.zip (159.8 KB)


#2

@philipqian.163,

我建议您尝试使用以下示例代码。

public static void TestPresentationChart()
{
    String path = @"C:\Aspose Data\CpatureText\";

    Presentation pres = new Presentation(path+"CpatureText.pptx");

    ISlide slide = pres.Slides[0];

    foreach (IShape shape in slide.Shapes)
    {
        if(shape is IChart)
        {
            IChart chart = (IChart)shape;
            foreach (IShape ishp in chart.UserShapes.Shapes)
            {
                if (ishp is IAutoShape)
                {
                    String se = ((IAutoShape)ishp).TextFrame.Text;
                }

            }
        }
    }
}