3
我已經使用的代碼如下申請兩種不同的字符樣式到一個段落的兩分:不同的樣式在文字處理在C#中符合opxnxml
Paragraph heading = new Paragraph();
ParagraphProperties heading_pPr = new ParagraphProperties();
heading.Append(heading_pPr);
Run Run1 = new Run() { RsidRunProperties = "009531B2" };
Text Text_Run1 = new Text("THIS IS TEST RUN 1");
Run1.Append(Text_Run1);
RunProperties rpr_Run1 = new RunProperties();
rpr_Run1.RunStyle = new RunStyle() { Val = "CharacterStyle1" };
Run Run2 = new Run();
RunProperties rpr_Run2 = new RunProperties();
rpr_Run2.RunStyle = new RunStyle() { Val = "CharacterStyle2" };
Text text_Run2 = new Text("THIS IS TEST RUN 2");
Run2.Append(text_Run2);
heading.Append(Run1);
heading.Append(Run2);
body.Append(heading);
但在運行代碼後,在Word文件這些運行獲得正常風格。 我可以將段落樣式應用於段落,但我無法應用字體樣式運行,我的代碼中哪裏出錯?
在結論:
我怎麼能申請字符樣式運行以及如何與不同的樣式運行一個段落?