Skip to main content Skip to footer

C1Document: The underlying source of Reports and Documents

For a long time, you have been using ComponentOne reporting and document objects like FlexReport, C1PdfDocumentSource, and C1SSRSDocumentSource. But have you ever wondered how these objects are managed and what the underlying source that handles them in a uniform manner is? C1Document (or C1.Win.C1Document) library is the underlying framework that works behind these objects. This helps put forward C1Document's features and the document objects based on it. Whether it's loading a PDF in a viewer, adding features to FlexReport and loading it in a viewer, or loading SSRS reports and showcasing their features in a viewer, C1Document is the source that is managing these functions in the background. C1DocumentSource is the abstract base class for components that are used to build instances of C1Document from various data: C1FlexReport builds documents from report definitions and data sources, C1PdfDocumentSource from PDF files, and C1SSRSDocumentSource from SSRS reports. Controls that consume C1Document objects (e.g. C1FlexViewer) actually connect to instances of C1DocumentSource type rather than to C1Document. Here are some key features of C1Document (please note that these features describe the technical architecture of reports and documents in the background):

  • Cross-platform: supports reports and documents in Winforms, WPF, and UWP platforms with minimal code differences.
  • Complete framework to create reports and documents.
  • Provides infrastructure for asynchronous document generation.
  • Supports the notion of parameters used in C1FlexReport and SSRS documents.
  • Supports text searching in documents.
  • Provides export filters for reports and document objects to export them to various major export formats.

Please note that C1Document can't be used directly as a document or report, but the objects derived from it can be used to create reports and documents. The following codes show how the derived objects are connected to C1Document.

How to use C1Document to load and view PDF file

You can use the C1PDFDocumentSource component of C1Document to load a PDF file. This PDF component can read, print, and export your PDF documents without any third party PDF reader or software. It also acts as a key component to load and view your PDFs in C1FlexViewer. You can load a PDF file using C1Document with the following code:

C1.Win.C1Document.C1PdfDocumentSource pdfdoc=new C1.Win.C1Document.C1PdfDocumentSource();  

pdfdoc.LoadFromFile(@"..\\..\\DefaultDocument.pdf");  

//Assign the PDFDocumentSource to FlexViewer, to view the PDF File  

c1FlexViewer.DocumentSource=pdfdoc;  


FlexViewerPDFSupport To learn more about key features of this component, why you should use it, and different use cases where it can help, please visit this blog

How to use C1Document to load and view a SSRS Document

C1SSRSDocumentSource helps to load SSRS reports in FlexViewer and supports other SSRS features. The following features in SSRS reports are supported in C1SSRSDocumentSource:

  • Parameters
  • Drill down, drill through
  • Hyperlinks
  • Outlines

Here's how you load a SSRS document in FlexViewer using C1Document: <!-- p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Helvetica} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 25.0px Helvetica} span.s1 {color: #0433ff} span.s2 {color: #951100} -->

C1.Win.C1Document.C1SSRSDocumentSource ssrsdoc=new C1.Win.C1Document.C1SSRSDocumentSource();  

ssrsdoc.DocumentLocation =new  SSRSReportLocation("<ssrsUrl>", "AdventureWorks/Product Catalog" );  

ssrsdoc.Credential =new  NetworkCredential("ssrsUsername","ssrsPassword", "ssrsDomain");  

c1FlexViewer.DocumentSource=ssrsdoc;  


SSRS

Samples

You can find samples on PdfDocumentSource and SSRSDocumentSource at the following locations after installing C1Studio installer for WinForms, WPF, and UWP. These samples will be available in a week from now with 2017v2 Release. Winforms - C:\Users\\Documents\ComponentOneSamples\Winforms\C1Document\CS<(orVB)>\

WPF - C:\Users\\Documents\ComponentOneSamples\WPF\C1.WPF.Document\CS<(orVB)>\

  • PdfDocumentSourceSamples
  • PrintAndExport
  • SSRSViewerSample

UWP - C:\Users\\Documents\ComponentOneSamples\WPF\C1.WPF.Document\CS<(orVB)>\

  • PdfDocumentSourceSamples

Please visit C1Document documentation that will be released in a week from now for more information about C1Document and its derived components.

MESCIUS inc.

comments powered by Disqus