您如何将某些部分(我应该使用哪种类型的部分?)设置为横向或纵向?
我正在尝试创建具有以下部分属性的部分(请参见下面的代码),然后将该部分分别设置为横向或纵向。但是,当我使用此代码并创建中断段落时,代码会横向生成一个空白页。
public static SectionProperties PageOrientationPortrait()
{
SectionProperties sectionProperties2 = new SectionProperties();
PageSize pageSize = new PageSize()
{
Width = (UInt32Value)12240U,
Height = (UInt32Value)15840U,
Orient = PageOrientationValues.Portrait
};
PageMargin pageMargin = new PageMargin()
{
Top = 1440,
Right = (UInt32Value)1440U,
Bottom = 1440,
Left = (UInt32Value)1440U,
Header = (UInt32Value)720U,
Footer = (UInt32Value)720U,
Gutter = (UInt32Value)0U
};
Columns columns = new Columns() { Space = "720" };
DocGrid docGrid = new DocGrid() { LinePitch = 360 };
sectionProperties2.Append(pageSize, pageMargin, columns, docGrid);
return sectionProperties2;
}
public static SectionProperties PageOrientationLandScape()
{
SectionProperties sectionProperties = new SectionProperties();
PageSize pageSize = new PageSize()
{
Width = (UInt32Value)15840U,
Height = (UInt32Value)12240U,
Orient = PageOrientationValues.Landscape
};
PageMargin pageMargin = new PageMargin()
{
Top = 1440,
Right = (UInt32Value)1440U,
Bottom = 1440,
Left = (UInt32Value)1440U,
Header = (UInt32Value)720U,
Footer = (UInt32Value)720U,
Gutter = (UInt32Value)0U
};
Columns columns = new Columns() { Space = "720" };
DocGrid docGrid = new DocGrid() { LinePitch = 360 };
sectionProperties.Append(pageSize, pageMargin, columns, docGrid);
return sectionProperties;
}
public static Paragraph GenerateSectionBreakParagraph()
{
Paragraph paragraph232 = new Paragraph();
ParagraphProperties paragraphProperties220 = new ParagraphProperties();
SectionProperties sectionProperties1 = new SectionProperties();
SectionType sectionType1 = new SectionType() { Val = SectionMarkValues.NextPage };
sectionProperties1.Append(sectionType1);
paragraphProperties220.Append(sectionProperties1);
paragraph232.Append(paragraphProperties220);
return paragraph232;
}