本文整理汇总了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);
}
示例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
}
示例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);
}
示例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);
}
示例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();
}
示例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();
}
示例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
}