如何在 OpenOffice 中设置 TextTable 单元格的文本方向?

发布于 2024-07-22 06:16:22 字数 251 浏览 7 评论 0原文

我想设置 TextTable 中某些单元格的文本方向,使它们是垂直的(即文本是横向而不是纵向)。 您可以在 Writer 中通过选择单元格来执行此操作,然后转到: 表 - 文本属性 - 文本流 - 文本方向

但是,我不知道如何通过 API 执行此操作。 我尝试使用 CharRotation,但它的行为不正确。 CharRotation 只是获取文本并旋转它(不调整任何格式)。 我正在处理的文本是按制表位格式化的,并且以这种方式旋转时行为不正确。

I want to set the text direction for some cells in a TextTable so that they are vertical (i.e., the text is landscape instead of portrait).
You can do this in Writer by selecting the cell(s), and going to:
Table - Text Properties - Text Flow - Text Direction

However, I cannot figure out how to do this through the API. I tried using CharRotation, but it does not behave the right way. CharRotation simply takes the text, and rotates it (without adjusting any formatting). The text I am dealing with is formatted by tab stops, and does not behave correctly when rotated this way.

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

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

发布评论

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

评论(1

無心 2024-07-29 06:16:22

经过这几个月我终于想通了!

您必须设置单元格的“WritingMode”属性。 在 C# 中:

XCell cell = table.getCellByName(cellName);
((XPropertySet)cell).setPropertyValue("WritingMode", new Any((short) 
WritingMode.TB_RL));

我还没有在 python 中尝试过,但我想它会是这样的:

cell = table.getCellByName(cellName)
cell.WritingMode = 2

如果您使用的是静态类型语言,请确保将其转换为 Short。 由于某些奇怪的原因,执行 typeof(WritingMode) 不起作用。

请参阅 OOo 错误跟踪器中的此问题

I finally figured this out after all these months!

You have to set the "WritingMode" property for the cell. In C#:

XCell cell = table.getCellByName(cellName);
((XPropertySet)cell).setPropertyValue("WritingMode", new Any((short) 
WritingMode.TB_RL));

I haven't tried it in python yet, but I suppose it would be something like this:

cell = table.getCellByName(cellName)
cell.WritingMode = 2

If you're using a statically typed language, make sure you cast it to a short. Doing typeof(WritingMode) won't work, for some odd reason.

See this issue in the OOo bug tracker.

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