Word上下标


#1

如何实现输出word文件时,一整句中,部分词或数字作上标或下标处理,谢谢


#2

@philipqian.163,

请尝试使用以下Aspose.Words for .NET代码。

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Writeln("Whole Sentence");
builder.Write("Part of the sentence ");
builder.Write("Subscript");
builder.Font.Subscript = true;
builder.Write("1 ");
builder.Font.ClearFormatting();
builder.Write("Superscript");
builder.Font.Superscript = true;
builder.Write("500 ");
builder.Font.ClearFormatting();
builder.Writeln();
builder.Font.Color = Color.Red;
builder.Writeln("end of document");
doc.Save("E:\\temp\\19.9.docx");