當前位置:編程學習大全網 - 編程語言 - 如何利用OpenXML SDK 2.0 編程向docx寫入含有強制換行符 的字符

如何利用OpenXML SDK 2.0 編程向docx寫入含有強制換行符 的字符

public static Paragraph GenerateParagraph()

{

var element =

new Paragraph(

new Run(

new Text("This is the first line")

){ RsidRunProperties = "00CF4A05" },

new Run(

new Break(),

new Text("This is the second line")

){ RsidRunProperties = "00CF4A05" }

){ RsidParagraphMarkRevision = "00CF4A05", RsidParagraphAddition = "00FD48A2", RsidParagraphProperties = "00CF4A05", RsidRunAdditionDefault = "00A03D24" };

return element;

}

OR split these in two separate paragraphs. Effect is same , but the difference comes when we start applying styles to these.

Like this

public static Paragraph GenerateParagraph()

{

var element =

new Paragraph(

new Run(

new Text("This is the first line")

){ RsidRunProperties = "00CF4A05" }

){ RsidParagraphMarkRevision = "00CF4A05", RsidParagraphAddition = "00A03D24", RsidParagraphProperties = "00CF4A05", RsidRunAdditionDefault = "00A03D24" };

return element;

}

public static Paragraph GenerateParagraph()

{

var element =

new Paragraph(

new Run(

new Text("This is the second line")

){ RsidRunProperties = "00CF4A05" }

){ RsidParagraphMarkRevision = "00CF4A05", RsidParagraphAddition = "00A03D24", RsidParagraphProperties = "00CF4A05", RsidRunAdditionDefault = "00A03D24" };

return element;

}

  • 上一篇:無錫學院02專業組有哪些專業可以選
  • 下一篇:名偵探柯南集名稱
  • copyright 2024編程學習大全網