了解 WordProcessingML 标签并避免不必要的标签

发布于 2024-08-25 03:06:04 字数 566 浏览 6 评论 0原文

我正在使用 MS Word API 生成 .docx,其中包含从数据库获取的数据,其中我应用了相应的样式、字体、符号等。如果从数据库获取的数据相当大,那么就会出现问题在 .docx 文件中显示这些数据。我发现MS Word 2007内部会通过标签写入一些内容,这些内容可能不需要显示数据。因此,我正在弄清楚转换为 .xml 文件时需要哪些必要的 MS Word 标签。这样我就可以避免不必要的标签,并仅构建显示数据所需的相应标签。因此,我计划使用所需的 MS Word 标签编写自己的 .xml,而不是从 .docx 文件生成 .XML

我的疑问是:-

1)MS Word 是否会生成一些可能不会的标签是正确的将 .docx 转换为 document.xml 期间需要吗?这样就很重了?如果是这样,标签是什么,这样我在用自己的 .xml 文件编写时就可以避免它们。 2)请发送链接了解MS Word标签及其优点,哪些标签需要,哪些不需要? 3)我编写类似于document.xml(.docx转换)的新.xml的方法是否值得继续前进,以便我可以使用我需要的标签构建.xml,以便我可以提高性能数据显示?

请阐明一些情况并提前致谢..

谢谢, 里图

I am using MS Word API to generate .docx which contains the data fetched from DB, in which i am applying the respective styles, fonts, symbols, etc. If the data fetched from the DB is quite huge, then there is a problem in displaying those data in the .docx file. I found that internally MS Word 2007 will write some content through tags which may not be needed to display the data. Hence i am figuring out what are the necessary MS Word tags needed when converting into a .xml file. So that i can avoid unnecessary tags and build only the respective tags which are needed to display the data. Hence i am planning to write my own .xml with the MS Word tags which are needed, than generating a .XML from .docx file

My queries are:-

1) Whether it is right that the MS Word will generate some tags which may not be needed during the conversion of .docx to document.xml? That makes it heavy? If so what are the tags , so that i can avoid them when write by own .xml file.
2) Please send links to understand about the MS Word tags and its advantages, which tags are needed and which are not ?
3) Whether my approach to write a new .xml similar to document.xml (.docx conversion) is worthy one to go forward so that i can build the .xml with the tags i needed , so that i can improve the performance of the data display?

Please shed some light into it and thanks in advance..

Thanks,
Rithu

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

橘香 2024-09-01 03:06:04

您需要了解更多WordprocessingML 详细信息 执行此操作。这当然不是不可能的,但一开始就是一个相当长的学习曲线。也许最好的起点就是这本电子书。如果您选择手动路线,则需要拉链技术。如果您使用的是 Visual Studio,则可以使用 开放 XML SDK

至于你关于“不必要的标签”的问题,很难相信文件中会有很多不必要的东西。但这取决于您认为不需要的内容 - 例如,如果某个单词被捕获为拼写错误,则 Run 标记上将会有“dirty=1”属性。如果您可以接受显示拼写错误的单词,那么这可能被认为是不必要的。实际上取决于您展示的目的和内容。

You'll want to learn WordprocessingML in much more detail to do this. It certainly isn't impossible, but it is quite a learning curve to start with. Probably the best place to start is with this eBook. If you go the manual route, you'll need a zip technology. If you're in Visual Studio, you can make the writing of all of this easier by using the Open XML SDK.

As to your questions on 'unnecessary tags', it's hard to believe that there would be much at all in the file that is unnecessary. But that depends on what you consider not needed - for example, if a word is caught as mispelled, there will be "dirty=1" attribute on the Run tag. If you're okay with displaying mispelled words, then that could be considered unnecessary. Really depends on what you're displaying for and in what.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文