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


C# Document.AcceptAllRevisions方法代码示例

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


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

示例1: Main

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

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

示例2: AcceptAllRevisions

 public void AcceptAllRevisions()
 {
     //ExStart
     //ExFor:Document.AcceptAllRevisions
     //ExId:AcceptAllRevisions
     //ExSummary:Shows how to accept all tracking changes in the document.
     Document doc = new Document(MyDir + "Document.doc");
     doc.AcceptAllRevisions();
     //ExEnd
 }
开发者ID:nausherwan-aslam,项目名称:Aspose_Words_NET,代码行数:10,代码来源:ExComment.cs

示例3: 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");
            doc.AcceptAllRevisions();

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

示例4: Run

        public static void Run()
        {
            // ExStart:AcceptAllRevisions
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_WorkingWithDocument();
            Document doc = new Document(dataDir + "Document.doc");

            // Start tracking and make some revisions.
            doc.StartTrackRevisions("Author");
            doc.FirstSection.Body.AppendParagraph("Hello world!");

            // Revisions will now show up as normal text in the output document.
            doc.AcceptAllRevisions();

            dataDir = dataDir + "Document.AcceptedRevisions_out.doc";
            doc.Save(dataDir);
            // ExEnd:AcceptAllRevisions
            Console.WriteLine("\nAll revisions accepted.\nFile saved at " + dataDir);
        }        
开发者ID:aspose-words,项目名称:Aspose.Words-for-.NET,代码行数:19,代码来源:AcceptAllRevisions.cs

示例5: GenerateDoc


//.........这里部分代码省略.........
            try
            {
                doc.UpdateFields();
                doc.Range.UpdateFields();
            }
            catch (Exception)
            {
                // Error sometimes occurrs in Aspose when calling UpdateFields.
            }

            NodeCollection paragraphs = doc.GetChildNodes(NodeType.Paragraph, true);

            foreach (Paragraph para in paragraphs)
            {
                if (para.IsListItem)
                {
                    foreach (Node node in para.ChildNodes)
                    {
                        Run run = node as Run;

                        if (run != null)
                        {
                            bool runBeginsWithATab = run.Range.Text.Count() > 0 && run.Range.Text[0] == '\t';

                            if (runBeginsWithATab)
                            {
                                run.Text = run.Range.Text.Remove(0, 1);
                            }
                        }
                    }
                }
            }

            MemoryStream stream = new MemoryStream();
            doc.BuiltInDocumentProperties.LastSavedTime = DateTime.UtcNow;
            try
            {
                doc.UpdateFields();
            }
            catch (Exception)
            {
                // Error sometimes occurrs in Aspose when calling UpdateFields.
            }
            doc.AcceptAllRevisions();

            if (configData.IsCIP)
            {
                if (configData.BodyTemplate != null)
                {
                    MemoryStream newStream2 = null;
                    if (configData.BodyTemplate != null)
                    {
                        using (newStream2 = new MemoryStream(configData.BodyTemplate))
                        {
                            Document bodyDoc = new Document(newStream2);
                            InsertDocumentAtBookmark(Bookmarks.BPLUS_BODY, doc, bodyDoc);
                        }
                    }
                }
                else
                {
                    if (doc.Range.Bookmarks[Bookmarks.BPLUS_BODY] != null)
                    {
                        doc.Range.Bookmarks[Bookmarks.BPLUS_BODY].Text = "";
                    }
                }

            }

            try
            {
                if (configData.LockDocument)
                {
                    doc.Protect(ProtectionType.ReadOnly);
                }

                if (configData.IsGenerateTaskDocument && doc.ProtectionType == ProtectionType.AllowOnlyFormFields)
                {
                    doc.Unprotect();
                    doc.Protect(ProtectionType.AllowOnlyFormFields, "BOA1234");
                }

                // Save the document to the memory stream.
                switch (configData.Format)
                {
                    case "pdf":
                        doc.Save(stream, SaveFormat.Pdf);
                        break;
                    default:
                        doc.Save(stream, SaveFormat.Doc);
                        break;
                }
            }
            catch (Exception e)
            {
                throw e;
            }

            return stream.ToArray();
        }
开发者ID:khangtran-steadfast,项目名称:DatabaseConversion,代码行数:101,代码来源:WordGenerator.cs

示例6: GenerateFinalCIPDoc

        public static byte[] GenerateFinalCIPDoc(byte[] docTemplate, byte[] bodyTemplate, Tuple<Dictionary<string, string>, Dictionary<string, string[,]>> documentValues,
            byte[] schedule, int docType, string path, string format, bool draft, int scheduleType)
        {
            Document boaDocumentTemplate = GetBOADocumentTemplate();

            MemoryStream newStream = null;
            if (bodyTemplate != null)
            {
                newStream = new MemoryStream(bodyTemplate);
            }

            // Read the document from the stream.
            Document doc = new Document(newStream);

            InsertBlockAtBookamrk(boaDocumentTemplate, Bookmarks.BPLUS_PREMIUMS, doc, docType);
            InsertBlockAtBookamrk(boaDocumentTemplate, Bookmarks.BPLUS_SCHEDULE, doc, scheduleType);
            InsertBlockAtBookamrk(boaDocumentTemplate, Bookmarks.BPLUS_PARTICULARS, doc, docType);
            InsertBlockAtBookamrk(boaDocumentTemplate, Bookmarks.FSRA_NOTICE1, doc, docType);
            InsertBlockAtBookamrk(boaDocumentTemplate, Bookmarks.BPLUS_HEADER, doc, docType);
            InsertBlockAtBookamrk(boaDocumentTemplate, Bookmarks.BPLUS_PAYMENT, doc, docType);
            InsertBlockAtBookamrk(boaDocumentTemplate, Bookmarks.BPLUS_DUTYOFDISCLOSURE, doc, 0);

            // Save Document after adding BookMark and call
            MemoryStream middleStream = new MemoryStream();
            doc.Save(middleStream, SaveFormat.Doc);

            docTemplate = GenerateBodyDoc(middleStream.GetBuffer(), null,null,null,null, documentValues, false, SaveFormat.Doc);
            newStream = new MemoryStream(docTemplate);
            doc = new Document(newStream);

            if (bodyTemplate != null)
            {
                MemoryStream rtfStream = new MemoryStream(bodyTemplate);
                Document rtfDoc = new Document(rtfStream);
                InsertDocumentAtBookmark(Bookmarks.BPLUS_BODY, doc, rtfDoc);
            }
            else
            {
                if (doc.Range.Bookmarks[Bookmarks.BPLUS_BODY] != null)
                {
                    doc.Range.Bookmarks[Bookmarks.BPLUS_BODY].Text = "";
                }
            }

            if (schedule  != null)
            {
                MemoryStream rtfStream = new MemoryStream(schedule);
                Document rtfDoc = new Document(rtfStream);
                InsertDocumentAtBookmark(Bookmarks.POL_PARTICULARS, doc, rtfDoc);
            }

            if (draft)
            {
                InsertWatermarkText(doc,Bookmarks.DRAFT);
            }

            MemoryStream stream = new MemoryStream();
            doc.BuiltInDocumentProperties.LastSavedTime = DateTime.UtcNow;
            doc.UpdateFields();
            doc.AcceptAllRevisions();
            try
            {
                // Save the document to the memory stream.
                switch (format)
                {
                    case "pdf":
                        doc.Save(stream, SaveFormat.Pdf);
                        break;
                    default:
                        doc.Save(stream, SaveFormat.Doc);
                        break;
                }
            }
            catch (Exception e)
            {
                throw e;
            }

            return stream.GetBuffer();
        }
开发者ID:khangtran-steadfast,项目名称:DatabaseConversion,代码行数:80,代码来源:WordGenerator.cs

示例7: AcceptAllRevisions

        public void AcceptAllRevisions()
        {
            //ExStart
            //ExFor:Document.AcceptAllRevisions
            //ExSummary:Shows how to accept all tracking changes in the document.
            Document doc = new Document(MyDir + "Document.doc");

            // Start tracking and make some revisions.
            doc.StartTrackRevisions("Author");
            doc.FirstSection.Body.AppendParagraph("Hello world!");

            // Revisions will now show up as normal text in the output document.
            doc.AcceptAllRevisions();
            doc.Save(MyDir + @"\Artifacts\Document.AcceptedRevisions.doc");
            //ExEnd
        }
开发者ID:aspose-words,项目名称:Aspose.Words-for-.NET,代码行数:16,代码来源:ExDocument.cs


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