当前位置: 首页>>代码示例>>C#>>正文


C# DocumentBuilder.MoveToDocumentStart方法代码示例

本文整理汇总了C#中DocumentBuilder.MoveToDocumentStart方法的典型用法代码示例。如果您正苦于以下问题:C# DocumentBuilder.MoveToDocumentStart方法的具体用法?C# DocumentBuilder.MoveToDocumentStart怎么用?C# DocumentBuilder.MoveToDocumentStart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DocumentBuilder的用法示例。


在下文中一共展示了DocumentBuilder.MoveToDocumentStart方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            // Check for license and apply if exists
            string licenseFile = AppDomain.CurrentDomain.BaseDirectory + "Aspose.Words.lic";
            if (File.Exists(licenseFile))
            {
                // Apply Aspose.Words API License
                Aspose.Words.License license = new Aspose.Words.License();
                // Place license file in Bin/Debug/ Folder
                license.SetLicense("Aspose.Words.lic");
            }
            Document doc = new Document("../../data/document.doc");
            DocumentBuilder builder = new DocumentBuilder(doc);

            //Shows how to access the current node in a document builder.
            Node curNode = builder.CurrentNode;
            Paragraph curParagraph = builder.CurrentParagraph;

            // Shows how to move a cursor position to a specified node.
            builder.MoveTo(doc.FirstSection.Body.LastParagraph);

            // Shows how to move a cursor position to the beginning or end of a document.
            builder.MoveToDocumentEnd();
            builder.Writeln("This is the end of the document.");

            builder.MoveToDocumentStart();
            builder.Writeln("This is the beginning of the document.");

            doc.Save("outputDocument.doc");
        }
开发者ID:aspose-words,项目名称:Aspose.Words-for-.NET,代码行数:30,代码来源:Program.cs

示例2: MoveToDocumentStartEnd

        public static void MoveToDocumentStartEnd(string dataDir)
        {
            // ExStart:DocumentBuilderMoveToDocumentStartEnd
            Document doc = new Document(dataDir + "DocumentBuilder.doc");
            DocumentBuilder builder = new DocumentBuilder(doc);

            builder.MoveToDocumentEnd();
            Console.WriteLine("\nThis is the end of the document.");

            builder.MoveToDocumentStart();
            Console.WriteLine("\nThis is the beginning of the document.");
            // ExEnd:DocumentBuilderMoveToDocumentStartEnd            
        }
开发者ID:aspose-words,项目名称:Aspose.Words-for-.NET,代码行数:13,代码来源:DocumentBuilderMovingCursor.cs

示例3: Main

        static void Main(string[] args)
        {
            Document doc = new Document("../../data/document.doc");
            DocumentBuilder builder = new DocumentBuilder(doc);

            //Shows how to access the current node in a document builder.
            Node curNode = builder.CurrentNode;
            Paragraph curParagraph = builder.CurrentParagraph;

            // Shows how to move a cursor position to a specified node.
            builder.MoveTo(doc.FirstSection.Body.LastParagraph);

            // Shows how to move a cursor position to the beginning or end of a document.
            builder.MoveToDocumentEnd();
            builder.Writeln("This is the end of the document.");

            builder.MoveToDocumentStart();
            builder.Writeln("This is the beginning of the document.");

            doc.Save("outputDocument.doc");
        }
开发者ID:joyang1,项目名称:Aspose_Words_NET,代码行数:21,代码来源:Program.cs

示例4: DocumentBuilderMoveToDocumentStartEnd

        public void DocumentBuilderMoveToDocumentStartEnd()
        {
            //ExStart
            //ExId:DocumentBuilderMoveToDocumentStartEnd
            //ExSummary:Shows how to move a cursor position to the beginning or end of a document.
            Aspose.Words.Document doc = new Aspose.Words.Document(ExDir + "DocumentBuilder.doc");
            DocumentBuilder builder = new DocumentBuilder(doc);

            builder.MoveToDocumentEnd();
            builder.Writeln("This is the end of the document.");

            builder.MoveToDocumentStart();
            builder.Writeln("This is the beginning of the document.");
            //ExEnd
        }
开发者ID:joyang1,项目名称:Aspose_Words_NET,代码行数:15,代码来源:ExDocumentBuilder.cs

示例5: WorkingWithNodes

        public void WorkingWithNodes()
        {
            //ExStart
            //ExFor:DocumentBuilder.MoveTo(Node)
            //ExFor:DocumentBuilder.MoveToBookmark(String)
            //ExFor:DocumentBuilder.CurrentParagraph
            //ExFor:DocumentBuilder.CurrentNode
            //ExFor:DocumentBuilder.MoveToDocumentStart
            //ExFor:DocumentBuilder.MoveToDocumentEnd
            //ExSummary:Shows how to move between nodes and manipulate current ones.
            Aspose.Words.Document doc = new Aspose.Words.Document(ExDir + "DocumentBuilder.WorkingWithNodes.doc");
            DocumentBuilder builder = new DocumentBuilder(doc);

            // Move to a bookmark and delete the parent paragraph.
            builder.MoveToBookmark("ParaToDelete");
            builder.CurrentParagraph.Remove();

            // Move to a particular paragraph's run and replace all occurrences of "bad" with "good" within this run.
            builder.MoveTo(doc.LastSection.Body.Paragraphs[0].Runs[0]);
            builder.CurrentNode.Range.Replace("bad", "good", false, true);

            // Mark the beginning of the document.
            builder.MoveToDocumentStart();
            builder.Writeln("Start of document.");

            // Mark the ending of the document.
            builder.MoveToDocumentEnd();
            builder.Writeln("End of document.");

            doc.Save(ExDir + "DocumentBuilder.WorkingWithNodes Out.doc");
            //ExEnd
        }
开发者ID:joyang1,项目名称:Aspose_Words_NET,代码行数:32,代码来源:ExDocumentBuilder.cs

示例6: GenerateOutPutDocument

    protected void GenerateOutPutDocument(string outFileName)
    {
        //Open the template document
        Document doc = new Document(Server.MapPath("~/App_Data/DocumentBuilderDemo.docx"));

        //Once the builder is created, its cursor is positioned at the beginning of the document.
        DocumentBuilder builder = new DocumentBuilder(doc);

        builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
        BarCodeBuilder barCode = CreateBarCode();
        builder.InsertImage(barCode.BarCodeImage);

        builder.MoveToDocumentStart();

        System.Drawing.Image image = System.Drawing.Image.FromFile(Server.MapPath("~/Web/Images/spring-air-logo-header.jpg"));
        builder.InsertImage(image);

        builder.InsertParagraph();
        builder.ParagraphFormat.ClearFormatting();
        builder.Font.ClearFormatting(); 

        builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
        builder.ParagraphFormat.Shading.ForegroundPatternColor = System.Drawing.Color.White;
        builder.ParagraphFormat.Shading.Texture = TextureIndex.TextureSolid;
        builder.ParagraphFormat.LeftIndent = ConvertUtil.InchToPoint(0.3);
        builder.ParagraphFormat.SpaceBefore = 12;
        builder.ParagraphFormat.SpaceAfter = 12;
              
        builder.Font.Name = "Arial";
        builder.Font.Size = 9;
        builder.Write("ELECTRONIC TICKET - PASSENGER ITINERARY/RECEIPT");
        builder.InsertBreak(BreakType.LineBreak);
        builder.Writeln("CUSTOMER COPY - Powered by ASPOSE");
        builder.ParagraphFormat.ClearFormatting();

        builder.InsertHtml("<hr>");

        BuildBookingTable(builder);

        builder.MoveToDocumentEnd();
        builder.InsertBreak(BreakType.LineBreak);

        builder.InsertHtml("<hr>");

        builder.InsertParagraph();
        builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
        builder.InsertImage(barCode.BarCodeImage);


        doc.Save(Response, outFileName, ContentDisposition.Inline, null);
        Response.End();
    }
开发者ID:johnnydeamer,项目名称:Aspose_for_Spring.NET,代码行数:52,代码来源:ReservationConfirmationPage.aspx.cs

示例7: CreateWord

        public static bool CreateWord(List<Table_Column> list, string path)
        {
            DocumentBuilder wordApp; //   a   reference   to   Word   application

            Document wordDoc;//   a   reference   to   the   document
            wordDoc = new Document();//初始化
            wordApp = new DocumentBuilder(wordDoc);

            try
            {
                string text = "数据库名:";
                var gpbDbTabCols = list.GroupBy(p => p.TABLE_NAME);

                int count = gpbDbTabCols.Count();// this.listTable2.Items.Count;

                wordApp.Bold = true;
                wordApp.Font.Size = 12f;
                wordApp.ParagraphFormat.Alignment = ParagraphAlignment.Left;
                // Create the headers.
                wordApp.MoveToHeaderFooter(HeaderFooterType.HeaderFirst);
                wordApp.Write("[复高自动生成器www.fugao.com]");
                wordApp.MoveToHeaderFooter(HeaderFooterType.HeaderEven);
                wordApp.Write("[复高自动生成器www.fugao.com]");
                wordApp.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
                wordApp.Write("[复高自动生成器www.fugao.com]");

                wordApp.MoveToDocumentStart();
                wordApp.Writeln(text);

                //
                int i = 0;
                foreach (var tab in gpbDbTabCols)
                {
                    string tableName = tab.Key;// this.listTable2.Items[i].ToString();
                    object missing = System.Type.Missing;
                    object length = text.Trim().Length;

                    wordApp.InsertBreak(BreakType.LineBreak);
                    wordApp.Writeln("表名:" + tableName);

                    Table tbl = wordApp.StartTable();
                    ParagraphAlignment paragraphAlignmentValue = wordApp.ParagraphFormat.Alignment;
                    wordApp.ParagraphFormat.Alignment = ParagraphAlignment.Center;

                    wordApp.RowFormat.Height = 25;

                    wordApp.InsertCell();
                    wordApp.Font.Size = 10.5;
                    wordApp.Font.Name = "宋体";
                    wordApp.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
                    wordApp.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
                    wordApp.CellFormat.Width = 50.0;
                    wordApp.CellFormat.PreferredWidth = Aspose.Words.Tables.PreferredWidth.FromPoints(50);
                    //设置外框样式
                    wordApp.CellFormat.Borders.LineStyle = LineStyle.Single;
                    //样式设置结束
                    wordApp.Write("序号");

                    wordApp.InsertCell();
                    wordApp.Font.Size = 10.5;
                    wordApp.Font.Name = "宋体";
                    wordApp.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
                    wordApp.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
                    wordApp.CellFormat.Width = 50.0;
                    wordApp.CellFormat.PreferredWidth = Aspose.Words.Tables.PreferredWidth.FromPoints(50);
                    //设置外框样式
                    wordApp.CellFormat.Borders.LineStyle = LineStyle.Single;
                    //样式设置结束
                    wordApp.Write("列名");

                    wordApp.InsertCell();
                    wordApp.Font.Size = 10.5;
                    wordApp.Font.Name = "宋体";
                    wordApp.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
                    wordApp.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
                    wordApp.CellFormat.Width = 50.0;
                    wordApp.CellFormat.PreferredWidth = Aspose.Words.Tables.PreferredWidth.FromPoints(50);
                    //设置外框样式
                    wordApp.CellFormat.Borders.LineStyle = LineStyle.Single;
                    //样式设置结束
                    wordApp.Write("数据类型");

                    wordApp.InsertCell();
                    wordApp.Font.Size = 10.5;
                    wordApp.Font.Name = "宋体";
                    wordApp.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
                    wordApp.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
                    wordApp.CellFormat.Width = 50.0;
                    wordApp.CellFormat.PreferredWidth = Aspose.Words.Tables.PreferredWidth.FromPoints(50);
                    //设置外框样式
                    wordApp.CellFormat.Borders.LineStyle = LineStyle.Single;
                    //样式设置结束
                    wordApp.Write("长度");

                    wordApp.InsertCell();
                    wordApp.Font.Size = 10.5;
                    wordApp.Font.Name = "宋体";
                    wordApp.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
                    wordApp.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
                    wordApp.CellFormat.Width = 50.0;
//.........这里部分代码省略.........
开发者ID:jiangpan,项目名称:HIT,代码行数:101,代码来源:WordHelper.cs


注:本文中的DocumentBuilder.MoveToDocumentStart方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。