Exemple #1
0
        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");
        }
Exemple #2
0
        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");
        }
        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");


        }
        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");


        }
        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");
        }
Exemple #6
0
        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");
        }
Exemple #7
0
        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");
        }