←Select platform

GenerateMarkdownReport Method

Summary

Generates a Markdown Report from the result set.

Syntax
C#
C++/CLI
Python
public void GenerateMarkdownReport( 
   Stream stream, 
   MarkdownReportOptions options 
) 
public:  
   void GenerateMarkdownReport( 
      Stream^ stream, 
      MarkdownReportOptions^ options 
   ) 
def GenerateMarkdownReport(self,stream,options): 

Parameters

stream

The stream used to save the report.

options

The MarkdownReportOptions to use when building the report.

Return Value

The report will be saved to the provided stream.

Example
C#
Java
using Leadtools.Document; 
using Leadtools.Document.Compare; 
using Leadtools; 
 
 
public void GenerateMarkdownReportExample() 
{ 
   var doc1 = DocumentFactory.LoadFromFile(pathToDocument1, new LoadDocumentOptions()); 
   var doc2 = DocumentFactory.LoadFromFile(pathToDocument2, new LoadDocumentOptions()); 
 
   var docList = new List<LEADDocument>() 
   { 
      doc1, 
      doc2 
   }; 
 
   var comparer = new DocumentComparer(); 
   var diffs = comparer.CompareDocument(docList); 
   using (MemoryStream ms = new MemoryStream()) 
   { 
      var options = new MarkdownReportOptions() 
      { 
         BaseCSSClass = "example-base", 
         BaseColor = "white", 
         DeletionCSSClass  = "example-delete", 
         DeletionColor = "crimson", 
         InsertionCSSClass = "example-insert", 
         InsertionColor = "lightgreen", 
         StrikethroughCSSClass = "example-strikethrough", 
         StrikethroughColor = "red", 
         UnderlineCSSClass = "example-underline", 
         UnderlineColor = "green", 
      }; 
      options.ReportFooters.Add("Example Report Footer"); 
      options.ReportHeaders.Add("Example Report Header"); 
      options.DocumentNames.Add(doc1.Name); 
      options.DocumentNames.Add(doc2.Name); 
 
 
      diffs.GenerateMarkdownReport(ms, options); 
      ms.Position = 0; 
 
      File.WriteAllBytes(@"report.md", ms.ToArray()); 
   } 
} 
 
import static org.junit.Assert.assertTrue; 
 
import java.io.ByteArrayOutputStream; 
import java.io.File; 
import java.io.IOException; 
import java.io.RandomAccessFile; 
 
import java.util.ArrayList; 
import java.util.List; 
 
import org.junit.*; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
 
import leadtools.document.DocumentFactory; 
import leadtools.document.DocumentPageText; 
import leadtools.document.LEADDocument; 
import leadtools.document.LoadDocumentOptions; 
import leadtools.document.compare.*; 
 
 
public void generateMarkdownReportExample() throws IOException { 
   final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images"; 
 
   String pathToDocument2 = combine(LEAD_VARS_IMAGES_DIR, "LEADTOOLSEditor.docx"); 
   String pathToDocument1 = combine(LEAD_VARS_IMAGES_DIR, "LEADTOOLSEditor.docx"); 
   LEADDocument doc1 = DocumentFactory.loadFromFile(pathToDocument1, new LoadDocumentOptions()); 
   LEADDocument doc2 = DocumentFactory.loadFromFile(pathToDocument2, new LoadDocumentOptions()); 
 
   List<LEADDocument> docList = new ArrayList<LEADDocument>(); 
   docList.add(doc1); 
   docList.add(doc2); 
   DocumentComparer comparer = new DocumentComparer(); 
   DocumentDifference diffs = comparer.compareDocument(docList); 
   RandomAccessFile file = new RandomAccessFile("report.md", "rw"); 
   ByteArrayOutputStream ms = new ByteArrayOutputStream(); 
   MarkdownReportOptions options = new MarkdownReportOptions(); 
 
   options.setBaseCSSClass("example-base"); 
   options.setBaseColor("white"); 
   options.setDeletionCSSClass("example-delete"); 
   options.setDeletionColor("crimson"); 
   options.setInsertionCSSClass("example-insert"); 
   options.setInsertionColor("lightgreen"); 
   options.setStrikethroughCSSClass("example-strikethrough"); 
   options.setStrikethroughColor("red"); 
   options.setUnderlineCSSClass("example-underline"); 
   options.setUnderlineColor("green"); 
 
   assertTrue(options.getUnderlineColor() == "green"); 
 
   options.getReportFooters().add("Example Report Footer"); 
   options.getReportHeader().add("Example Report Header"); 
   options.getDocumentName().add(doc1.getName()); 
   options.getDocumentName().add(doc2.getName()); 
 
   diffs.generateMarkdownReport(ms, options); 
 
   file.write(ms.toByteArray()); 
 
   System.out.println("Command run successfully"); 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Document.Compare Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.