开发者

Align decimal points on word tables using automation

I want to align decimal points on a word table using automation and C#.

I have used the following method:

   Object alignmentType=开发者_高级运维Word.WdTabAlignment.wdAlignTabDecimal;
      Object tabLeader=Word.WdTabLeader.wdTabLeaderSpaces;

      WordApp.ActiveDocument.ActiveWindow.Selection.ParagraphFormat.TabStops.Add(1,
         ref alignmentType, ref tabLeader);

But this did not work correctly, I'm not sure I understand the first parameter called position which takes float value. Is there something I'm missing? any help would be appreciated. Thanks in Advance, Sarah


That first parameter is probably the position in which the tab stop is created. You have to add a tabstop at a specifiek horizontal position.

If you switch to print layout in Word, you can make the rulers visible on which you can set and view the tabs. If you do this by hand, and record a macro, you can see what happens, how your document reponds, and what the code to do it looks like. That may help you gain more understanding of tab stops.


The first parameter is the horizontal coordinate of the TabStop in points, relative to the left margin.

See the documentation. (Yes, the Word API has documentation, although it's not always very useful)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜