Word 2010,用于从XML开始编写发票 [英] Word 2010 for writing invoices, starting with XML

查看:147
本文介绍了Word 2010,用于从XML开始编写发票的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在做相当多的发票生成,到目前为止,它基于一些非常糟糕的单词自动化,现在可以在Word 2010中进行审核.

we are doing quite some invoice generation, and so far it is based on some pretty awful word automation that is now in for a review with Word 2010.

我很想转向基于XML的格式来存储/显示发票,只在最后阶段访问了Word文档.这意味着我可以轻松地使用其他方式从XML内部显示发票.

I would love to move to a XML based format for storing / presenting invoices, only going to a word document in the last stage. This means I can use easily othermeans to present an invoice internally from the XML.

我们将Word用作最后阶段",因为Word比任何其他格式化方法都好得多-我们的发票有时在发票项目表中有很多文字,而Word在处理正确"的方式.

We use Word as "last stage" because Word is a lot better than anything else ever discovered for formatting - our invoices have quite some text sometimes, in the invoice item table, and word is smartest with handling page breaks in the "correct" way.

现在,这是我的问题:到目前为止,有没有合适的方法可以轻松地使用XML?我记得Word在2007年曾经有一些XML字段映射机制,但是它没有处理XML中的表.有什么改变吗?如果相关数据以XML格式提供,那么为发票生成.docx文档(以.dotx templace开头)的建议方法是什么?

Now, here my question: is there any proper way by now to do this with XML easily? I remember Word having (had) in 2007 some XML field mapping mechanism, but it did not handle tables in the XML. Was anything changed? What would be the proposed approach for generating an .docx document (starting with a .dotx templace) for an invoice, if the relevant data is available in XML form?

推荐答案

据我所知,有一些机制可以从xml自动构建msword 2007文档.主要思想是在您的xml上构建xslt转换.如您所知,word文档只是不同xml的存档(只需将扩展名更改为.zip,您就会看到).但是问题并不总是存在于一个xml文件中(我使用的是excel生成-那里有很多xml文件).

As far as I know there is some mechanism to automate building msword 2007 docs from xml. Main idea is to build xslt transformation on your xml. As you know word document is just an archive(just change extension to .zip and you will see) of different xml's. But problem that it is not always in one xml file(I worked with excel generation - there is a lot xml files there).

这也是一个很好的示例,说明如何准确地制作您想要的东西- http://www.codeproject.com/KB/office/Generating_Word_Reports.aspx ,但是我无法将其应用于msexcel文档.

Also here is great example how to make exactly what you want - http://www.codeproject.com/KB/office/Generating_Word_Reports.aspx but I was not able to apply this to msexcel documents..

所以我更喜欢使用DocumentFormat.OpenXml和DocumentFormat.OpenXml.Extensions生成msword或msexcel文档.

So I prefer to use DocumentFormat.OpenXml and DocumentFormat.OpenXml.Extensions to generate msword or msexcel documents.

这篇关于Word 2010,用于从XML开始编写发票的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆