关于使用Aspose.Words.dll操作word的问题

xiaojunfei3 2014-06-23 08:52:37
我用Aspose.Words.dll操作一个word文档

一个有4页的文档,我如何循环得到每页的文本内容?
...全文
435 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
save4me 2014-06-28
  • 打赏
  • 举报
回复
还有一个以前的办法参考: copy individual pages from word document to new document c#

String sourceDoc = dataDir + "source.docx";
String destinationtDoc = dataDir + "destination.docx";

// Initialize the Document instance with source and destination documents
Document doc = new Document(sourceDoc);
Document dstDoc = new Document();

// Remove the blank default page from new document
dstDoc.RemoveAllChildren();
PageNumberFinder finder = new PageNumberFinder(doc);
// Split nodes across pages
finder.SplitNodesAcrossPages(true);
// Get separate page sections
ArrayList pageSections = finder.RetrieveAllNodesOnPages(1, 5, NodeType.Section);
foreach (Section section in pageSections)
    dstDoc.AppendChild(dstDoc.ImportNode(section, true));
dstDoc.LastSection.Body.LastParagraph.Remove();
dstDoc.Save(destinationtDoc);
save4me 2014-06-28
  • 打赏
  • 举报
回复
使用 DocumentPageSplitter.cs通过页码来拆分成每页一个文档,然后通过SaveFormat.Text参数调用Document.Save来把文档保存成文本文件
xiaojunfei3 2014-06-27
  • 打赏
  • 举报
回复
来人啊,救命啊
xiaojunfei3 2014-06-25
  • 打赏
  • 举报
回复
就没人么,哪位来帮忙
xiaojunfei3 2014-06-24
  • 打赏
  • 举报
回复
这个地方我已经看了,我没有发现如何按页读取文本内容,我只看到sections能够读取,但奇怪的是,无论有几页,我得到的sections.count总是1,也就是说,一用section[0]读第一页的内容,实际上整篇文档的内容就全读出来了,没有实现按页读取word的内容
wangnaisheng 2014-06-23
  • 打赏
  • 举报
回复

110,500

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧