如何将单元格内容(InlineShape)向右对齐? [英] How to align cell content (InlineShape) to the right?
问题描述
我正在使用 C# 以编程方式创建 Word 文档(Office 16.0 Interop).
I am using C# to programmatically create a word document (Office 16.0 Interop).
在文档的标题部分,我添加了一个表格,其中一个单元格包含一张图片.但是,我无法使图片在单元格内与右侧对齐.默认情况下它是左对齐的(应该如此).
In the header section of the document I added a table of which one cell contains a picture. However, I can't get the picture to align to the right within the cell. It is left aligned by default (as it should be).
奇怪的是,单元格具有 WdCellVerticalAlignment
类型的 VerticalAlignment
属性,但似乎缺少用于水平对齐的属性.
Oddly enough, cells have a VerticalAlignment
property of type WdCellVerticalAlignment
but seem to lack a property for horizontal alignment.
如何将单元格内的 InlineShape 与右侧对齐?
How can I align an InlineShape within a cell to the right?
推荐答案
一旦您知道要对齐的对象,就相当简单了:
It's fairly simple once you know the object you are trying to align:
cell.Range.ParagraphFormat.Alignment = Word.wdAlignParagraphRight
这篇关于如何将单元格内容(InlineShape)向右对齐?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!