使用自动化对齐字表上的小数点

发布于 2024-10-06 06:41:48 字数 404 浏览 0 评论 0原文

我想使用自动化和 C# 对齐单词表上的小数点。

我使用了以下方法:

   Object alignmentType=Word.WdTabAlignment.wdAlignTabDecimal;
      Object tabLeader=Word.WdTabLeader.wdTabLeaderSpaces;

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

但这不能正常工作,我不确定我是否理解第一个名为position的参数,它采用浮点值。我有什么遗漏的吗?任何帮助将不胜感激。 提前致谢, 莎拉

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

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

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

发布评论

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

评论(2

公布 2024-10-13 06:41:48

第一个参数可能是创建制表位的位置。您必须在特定的水平位置添加制表位。

如果在 Word 中切换到打印布局,则可以使标尺可见,您可以在其上设置和查看选项卡。如果您手动执行此操作并录制宏,您可以看到发生了什么、文档如何响应以及执行此操作的代码是什么样的。这可能会帮助您更好地了解制表位。

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.

平安喜乐 2024-10-13 06:41:48

第一个参数是 TabStop 相对于左边距的水平坐标(以磅为单位)。

请参阅文档。 (是的,Word API 有文档,尽管它并不总是很有用)

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)

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