Free Support Forum - aspose.com

Aspose.word for .net 可以支持字符间距设置吗?


#1

如图中红框处所示QQ图片20190312120012.png (8.2 KB),aspose.word for .net 也可以实现字符间距的设置参数吗?还请指点如何进行设置?非常感谢。


#2

@chenxf,

请尝试使用以下代码:

Document doc = new Document();

// Get the paragraph from the document, we will be adding runs of text to it.
Paragraph para = (Paragraph)doc.GetChild(NodeType.Paragraph, 0, true);

// Add a run of text with characters 150% width of normal characters.
Run run = new Run(doc, "Wide characters");
run.Font.Scaling = 150;
para.AppendChild(run);

// Add a run of text with extra 1pt space between characters.
run = new Run(doc, "Expanded by 1pt");
run.Font.Spacing = 1;
para.AppendChild(run);

// Add a run of text with with space between characters reduced by 1pt.
run = new Run(doc, "Condensed by 1pt");
run.Font.Spacing = -1;
para.AppendChild(run);

doc.Save("E:\\temp\\19.3.docx");  

希望这可以帮助。


#3

抱歉,我试过了,这个代码无法实现。


#4

@chenxf,

请压缩并附上您在此处显示正确输出的预期文档以进行测试。 您可以使用MS Word创建预期文档。 还请列出您在MS Word中执行以创建预期文档的步骤。 然后,我们将在最后进一步调查该场景,并为您提供更多信息。