简体   繁体   English

如何使用delphi XE 5声明MS Word表居中

[英]How to allign a MS Word table to center Using delphi XE 5

I know how to allign the text inside a table's cells. 我知道如何在表格单元格中填充文本。

But i cannot figure out how to allign the entire table center 但是我无法弄清楚如何摆放整个桌子中心

I use the following code to create the table and to set its borders. 我使用以下代码创建表格并设置其边框。

wrdDoc.Tables.Add(wrdSelection.Range,1,1);
wrdDoc.Tables.Item(1).Columns.Item(1).SetWidth(462,wdAdjustNone);
wrdDoc.tables.Item(1).Borders.Item(wdBorderLeft).LineStyle := wdLineStyleDouble;
wrdDoc.tables.Item(1).Borders.Item(wdBorderRight).LineStyle := wdLineStyleDouble;
wrdDoc.tables.Item(1).Borders.Item(wdBorderVertical).LineStyle := wdLineStyleNone;
wrdDoc.tables.Item(1).Borders.Item(wdBorderTop).LineStyle := wdLineStyleDouble;
wrdDoc.tables.Item(1).Borders.Item(wdBorderBottom).LineStyle := wdLineStyleDouble;
wrdDoc.tables.Item(1).Borders.Item(wdBorderHorizontal).LineStyle := wdLineStyleNone;

How can i set the table properties to allign center? 如何将表格属性设置为allign center?

Note: i did find the page below which was supposed to have the sample code on microsoft's site, but it has nothing of worth. 注意:我确实找到了下面的页面,该页面应该在Microsoft的站点上具有示例代码,但没有任何价值。

http://msdn.microsoft.com/en-us/library/office/ff834583(v=office.14).aspx http://msdn.microsoft.com/en-us/library/office/ff834583(v=office.14).aspx

Any help would be appreciated. 任何帮助,将不胜感激。 Thank you 谢谢

I was able to finally get an answer on http://www.delphigroups.info/2/da/258008.html 我终于能够在http://www.delphigroups.info/2/da/258008.html找到答案

the code needed was wrdDoc.tables.Item(1).Rows.Alignment := wdAlignRowCenter; 所需的代码是wrdDoc.tables.Item(1).Rows.Alignment := wdAlignRowCenter;

But thanks anyway guys. 但是还是谢谢你们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM