你好,我遇到ppt中的一个文本框内容无法读取
代码如下:Test.zip (49.5 KB)
if ((shape as Aspose.Slides.AutoShape).TextFrame != null)
{
Content.Append((shape as Aspose.Slides.AutoShape).TextFrame.Text + “\n”);
}
文件在附件里,谢谢
你好,我遇到ppt中的一个文本框内容无法读取
代码如下:Test.zip (49.5 KB)
if ((shape as Aspose.Slides.AutoShape).TextFrame != null)
{
Content.Append((shape as Aspose.Slides.AutoShape).TextFrame.Text + “\n”);
}
文件在附件里,谢谢
在.NET 20.6的Aspose.Slides中使用以下示例代码,我发现阅读文本没有问题。 请尝试使用建议的版本。
public static void LoadTextFrame()
{
String path = @"C:\Users\mudas\Downloads\Test (3)\";
Presentation pres = new Presentation(path + "Test.pptx");
foreach(ISlide slide in pres.Slides)
{
foreach(IShape shape in slide.Shapes)
{
if(shape is IAutoShape)
{
IAutoShape ashp = (IAutoShape)shape;
if(ashp.TextFrame!=null)
{
ITextFrame texF = ashp.TextFrame;
String tex = ashp.TextFrame.Text;
}
}
}
}
}
是的,一般读取没有问题,但读取我上传的那个zip文件就有问题,请试试我上传的文件,谢谢
我读取它时并未出错,只是在获取Shape.TextFrame.Text时为空,这个文本框看起来也很正常,不懂为什么取不到值
能否请您确认最终使用的版本。 与适用于.NET 20.6的最新Aspose.Slides一样,即使加载test ppt.zip,我也会遇到异常。
在加载和提取Test pptx.zip 文本框时都没有发现问题。