本文整理汇总了C#中System.Windows.Forms.Document.AddSection方法的典型用法代码示例。如果您正苦于以下问题:C# Document.AddSection方法的具体用法?C# Document.AddSection怎么用?C# Document.AddSection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Document
的用法示例。
在下文中一共展示了Document.AddSection方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: button1_Click
private void button1_Click(object sender, EventArgs e)
{
//Create word document
Document document = new Document();
Section section = document.AddSection();
//page setup
SetPage(section);
//insert header and footer
InsertHeaderAndFooter(section);
//add cover
InsertCover(section);
//insert a break code
section = document.AddSection();
section.BreakCode = SectionBreakType.NewPage;
//add content
InsertContent(section);
//Save doc file.
document.SaveToFile("Sample.doc", FileFormat.Doc);
//Launching the MS Word file.
WordDocViewer("Sample.doc");
}
示例2: button1_Click
private void button1_Click(object sender, EventArgs e)
{
//Create word document
Document document = new Document();
Section section = document.AddSection();
section.PageSetup.PageSize = PageSize.A4;
section.PageSetup.Margins.Top = 72f;
section.PageSetup.Margins.Bottom = 72f;
section.PageSetup.Margins.Left = 89.85f;
section.PageSetup.Margins.Right = 89.85f;
Paragraph paragraph = section.AddParagraph();
paragraph.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Left;
paragraph.AppendPicture(ToPDF.Properties.Resources.Word);
String p1
= "Microsoft Word is a word processor designed by Microsoft. "
+ "It was first released in 1983 under the name Multi-Tool Word for Xenix systems. "
+ "Subsequent versions were later written for several other platforms including "
+ "IBM PCs running DOS (1983), the Apple Macintosh (1984), the AT&T Unix PC (1985), "
+ "Atari ST (1986), SCO UNIX, OS/2, and Microsoft Windows (1989). ";
String p2
= "Microsoft Office Word instead of merely Microsoft Word. "
+ "The 2010 version appears to be branded as Microsoft Word, "
+ "once again. The current versions are Microsoft Word 2010 for Windows and 2008 for Mac.";
section.AddParagraph().AppendText(p1).CharacterFormat.FontSize = 14;
section.AddParagraph().AppendText(p2).CharacterFormat.FontSize = 14;
//Save doc file to pdf.
document.SaveToFile("Sample.pdf", FileFormat.PDF);
//Launching the pdf reader to open.
FileViewer("Sample.pdf");
}
示例3: button1_Click
private void button1_Click(object sender, EventArgs e)
{
//Create word document
Document document = new Document();
Section section = document.AddSection();
//page setup
SetPage(section);
//insert header and footer
InsertHeaderAndFooter(section);
//add content
InsertContent(section);
//encrypt document with password specified by textBox1
document.Encrypt(this.textBox1.Text);
//Save doc file.
document.SaveToFile("Sample.doc",FileFormat.Doc);
//Launching the MS Word file.
WordDocViewer("Sample.doc");
}
示例4: button1_Click
private void button1_Click(object sender, EventArgs e)
{
//Create word document
Document document = new Document();
Section section = document.AddSection();
//the unit of all measures below is point, 1point = 0.3528 mm
section.PageSetup.PageSize = PageSize.A4;
section.PageSetup.Margins.Top = 72f;
section.PageSetup.Margins.Bottom = 72f;
section.PageSetup.Margins.Left = 89.85f;
section.PageSetup.Margins.Right = 89.85f;
//insert header and footer
InsertHeaderAndFooter(section);
addTable(section);
//Save doc file.
document.SaveToFile("Sample.doc",FileFormat.Doc);
//Launching the MS Word file.
WordDocViewer("Sample.doc");
}
示例5: button1_Click
private void button1_Click(object sender, EventArgs e)
{
//Create word document
Document document = new Document();
addTable(document.AddSection());
//Save xml file.
document.SaveToFile("Sample.xml",FileFormat.Xml);
//Launching the xml file.
XMLViewer("Sample.xml");
}
示例6: button1_Click
private void button1_Click(object sender, EventArgs e)
{
//Create word document
Document document = new Document();
//Create a new secition
Section section = document.AddSection();
//Create a new paragraph
Paragraph paragraph = section.AddParagraph();
//Append Text
paragraph.AppendText("Hello World!");
//Save doc file.
document.SaveToFile("Sample.doc",FileFormat.Doc);
//Launching the MS Word file.
WordDocViewer("Sample.doc");
}
示例7: button1_Click
private void button1_Click(object sender, EventArgs e)
{
Document document = new Document();
Section section = document.AddSection();
//page setup
SetPage(section);
//insert header and footer.
InsertHeaderAndFooter(section);
//add title
AddTitle(section);
//add form
AddForm(section);
//protect document, only form fields could be edited.
document.Protect(ProtectionType.AllowOnlyFormFields, "e-iceblue");
//Save doc file.
document.SaveToFile("Sample.doc",FileFormat.Doc);
//Launching the MS Word file.
WordDocViewer("Sample.doc");
}