2

我正在尝试简单地将一些文本从 c# 程序输出到新的 Word 文档,但我有一个奇怪的问题:我的很多输出都颠倒了。任何不以字母结尾的单词都会跳到句子的末尾。例如:

DocX doc= DocX.Create(filePath);
Paragraph p1 = template.InsertParagraph();
p1.AppendLine("This line contains a ").Append("bold").Bold().Append(" word.");
p1.AppendLine("Here is example with question mark?");
p1.AppendLine();
p1.AppendLine("Can you help me figure it out?");
p1.AppendLine();

代码输出

代码的输出

如您所见,以非字母结尾的句子被混淆了。我正在使用 2010 Office Word

4

1 回答 1

1

试试吧

Paragraph p1 = template.InsertParagraph();

用这个

Paragraph p1 = doc.InsertParagraph();
于 2015-08-23T08:33:06.590 回答