多个表到Word [英] Multiple Tables to Word
问题描述
我想知道是否有人可能会在我出错之前向我提出建议?
<我已经让OpenXML PowerTools能够很好地在Word中生成多行单结果表。 然而,一些明亮的火花现在已经决定我们现在需要将结果分成子类别,每个都有一个标题(在我看来,
现在这意味着单独的表?)
xml输出文件之前很简单,但现在我花了一点时间将输出分解为所需的子类别,它变得更加明显,我将无法只传递xml和文档模板
文件到DocumentBuilder函数! 我对xml的结构感到有点困惑,有什么(如果可能的话)会起作用。
有趣的是,没有一定数量的子类别每个报告,它每次都有所不同,所以很遗憾没有办法在Word中预先设置表格。
我是否必须完全自定义Docx创建过程? 我无法看到PowerTools如何做到这一点。
任何建议都会受到极大的欢迎!
希尔顿,
>>然而,一些明亮的火花现在已经决定我们现在需要将结果分成子类别,每个都有一个标题(在我看来这现在意味着单独的表?)
根据我的理解,你需要一个TableHeader类的实例。
它需要附加到标题行的TableRowProperties,你可以尝试代码下面:
var row = table.GetFirstChild< TableRow>();
if(row.TableRowProperties == null)
row.TableRowProperties = new TableRowProperties();
row.TableRowProperties.AppendChild(new TableHeader());如需了解更多信息,请查看以下链接:
如何使用OpenXml Wordprocessing为每个新页面在表格中创建标题
>> 我是否有要完全自定义Docx创建过程吗? 我无法看到如何使用PowerTools完成这项工作。
这里也是一些链接的摘要,供您更好地了解PowerTools for Open XML:
希望它可以帮到你。
最好的问候,
Yuki
Hi,
I was wondering if someone may be able to advise me on this before i set off in the wrong direction?
I've had the OpenXML PowerTools working perfectly well producing a multi-lined single table of results in Word. However, some bright spark has now decided that we now need to separate the results into subcategory's, with a title for each (in my mind this now means separate tables?)
The xml output files were previously straightforwards, but now I've spent a little bit of time breaking the output down into the required subcategory's its becoming more obvious that I'm not going to be able to just pass the xml and the document template files to the DocumentBuilder function! I'm a bit puzzled as to the structure of the xml for one, and what (if possible) would work.
The fun part is that there isn't a set number of subcategory's per report, it varies each time, so sadly there's no way to pre-set tables in Word any more.
Will I have to go for a full on custom Docx creation process? I can't see how this could be done with PowerTools.
Any advice would be greatly received!
Hi shilton,
>>However, some bright spark has now decided that we now need to separate the results into subcategory's, with a title for each (in my mind this now means separate tables?)
According to my understanding, an instance of the TableHeader class is what you need.
It needs to be appended to the header row's TableRowProperties, you can try the code as below:
var row = table.GetFirstChild<TableRow>(); if (row.TableRowProperties == null) row.TableRowProperties = new TableRowProperties(); row.TableRowProperties.AppendChild(new TableHeader());For more information, please review the following link:
How can I create a header in a table for each new page with OpenXml Wordprocessing
>> Will I have to go for a full on custom Docx creation process? I can't see how this could be done with PowerTools.
Here're also a summary of some links for you to better understand PowerTools for Open XML:
Hopefully it helps you.
Best Regards,
Yuki
这篇关于多个表到Word的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!