What's New in 2019 volume 2: File-Format Libraries | Syncfusion Blogs
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (174).NET Core  (29).NET MAUI  (207)Angular  (109)ASP.NET  (51)ASP.NET Core  (82)ASP.NET MVC  (89)Azure  (41)Black Friday Deal  (1)Blazor  (215)BoldSign  (14)DocIO  (24)Essential JS 2  (107)Essential Studio  (200)File Formats  (66)Flutter  (133)JavaScript  (221)Microsoft  (119)PDF  (81)Python  (1)React  (100)Streamlit  (1)Succinctly series  (131)Syncfusion  (915)TypeScript  (33)Uno Platform  (3)UWP  (4)Vue  (45)Webinar  (51)Windows Forms  (61)WinUI  (68)WPF  (159)Xamarin  (161)XlsIO  (36)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (8)Business intelligence  (55)Button  (4)C#  (147)Chart  (131)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (63)Development  (628)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (40)Extensions  (22)File Manager  (7)Gantt  (18)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (507)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (43)Performance  (12)PHP  (2)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (52)Security  (3)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (10)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (387)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (592)What's new  (332)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
Whats new file format

What’s New in 2019 Volume 2: Syncfusion File-Format Libraries (PDF, Excel, Word, and PowerPoint)

Syncfusion is happy to announce that our 2019 Volume 2 beta release has been rolled out. In this blog, we will give you a quick overview of the new features and enhancements introduced in our file-format libraries. Syncfusion file-format libraries provide .NET libraries to create, read, write, and convert PDF, Excel, Word, and PowerPoint files in .NET Framework, .NET Core, UWP, and Xamarin applications without Microsoft Office or Adobe dependencies.

Let’s dive into the details about the new features and enhancements.

PDF library

Add comments to PDF

During the review process, comments are useful to add a note about contents marked by annotations.

Now, you can add comments to markup annotations such as line, square, circle, polygon, polyline, highlight, underline, strikethrough, rubber stamp, ink, and so on using Syncfusion’s PDF library. It also provides a feature for replying to primary comments and setting a review status.

The following code example illustrates how to add comments, reply to them, and set the review status.

//Load the existing PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");

//Load the existing PDF page
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;

//Get the first annotation of the page.
PdfLoadedTextMarkupAnnotation loadedTextMarkupAnnotation = loadedPage.Annotations[0] as PdfLoadedTextMarkupAnnotation;

//Create a new comment
PdfPopupAnnotation userQuery = new PdfPopupAnnotation();
userQuery.Author = "John";
userQuery.Text = "Can you please change South Asian to Asian?";
userQuery.ModifiedDate = DateTime.Now;
//Add comment to the annotation
loadedTextMarkupAnnotation.Comments.Add(userQuery);

//Creates a new comment
PdfPopupAnnotation userAnswer = new PdfPopupAnnotation();
userAnswer.Author = "Smith";
userAnswer.Text = "South Asian has changed as Asian";
userAnswer.ModifiedDate = DateTime.Now;
//Add comment to the annotation
loadedTextMarkupAnnotation.Comments.Add(userAnswer);

//Creates a new review
PdfPopupAnnotation userAnswerReview = new PdfPopupAnnotation();
userAnswerReview.Author = "Smith";
userAnswerReview.State = PdfAnnotationState.Completed;
userAnswerReview.StateModel = PdfAnnotationStateModel.Review;
userAnswerReview.ModifiedDate = DateTime.Now;
//Add review to the comment
userAnswer.ReviewHistory.Add(userAnswerReview);

//Creates a new review
PdfPopupAnnotation userAnswerReviewJohn = new PdfPopupAnnotation();
userAnswerReviewJohn.Author = "John";
userAnswerReviewJohn.State = PdfAnnotationState.Accepted;
userAnswerReviewJohn.StateModel = PdfAnnotationStateModel.Review;
userAnswerReviewJohn.ModifiedDate = DateTime.Now;
//Add review to the comment
userAnswer.ReviewHistory.Add(userAnswerReviewJohn);

//Save and close the PDF document
loadedDocument.Save("AnnotationCommentAndReview.pdf");

loadedDocument.Close(true);

Output PDF File with Comments

Output PDF File with Comments

For more details about annotations and comments, check out our documentation: Working with PDF Annotations.

TIFF to PDF in .NET Core

The Syncfusion PDF library already supported TIFF-to-PDF conversion in .NET Framework platforms. Now, you can convert multi-frame TIFF images to PDF documents in .NET Core.

The following code example shows how to convert TIFF to PDF.

//Create a new PDF document
PdfDocument document = new PdfDocument();

//Set margin to the page
document.PageSettings.Margins.All = 0;

//Load TIFF image to stream
FileStream imageFileStream = new FileStream("image.tiff", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

//Load multi-frame TIFF image
PdfBitmap tiffImage = new PdfBitmap(imageFileStream);

//Get the frame count
int frameCount = tiffImage.FrameCount;

//Access each frame and draw onto the page
for (int i = 0; i < frameCount; i++)
{
//Add new page for each frame
PdfPage page = document.Pages.Add();

//Get page graphics
PdfGraphics graphics = page.Graphics;

//Set active frame
tiffImage.ActiveFrame = i;

//Draw TIFF image onto page
graphics.DrawImage(tiffImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height);
}

//Save PDF document
MemoryStream stream = new MemoryStream();

document.Save(stream);

//Close the PDF document
document.Close(true);

Output PDF File Created from a Multi-frame TIFF Image

Output PDF File Created from a Multi-frame TIFF Image

PDF 2.0

Support has been added to create a PDF document based on the PDF specification version 2.0 (ISO32000-2). You can specify the PDF version as required. When setting the PDF version as 2.0, deprecated elements will not be preserved in the resultant document.

Let’s see the code example of how to specify the PDF version as 2.0.

//Create a new PDF document
PdfDocument document = new PdfDocument();

//Set the PDF version
document.FileStructure.Version = PdfVersion.Version2_0;

//Add a new PDF page
PdfPage page = document.Pages.Add();

//Create new PdfStandard font
PdfStandardFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 16);

//Draw string to the PDF document page
page.Graphics.DrawString("Hello World!...", font, PdfBrushes.Black, new System.Drawing.PointF(0, 0));

//Save and close the PDF document
document.Save("PDFVersion2_0.pdf");
document.Close(true);

Output PDF File Generated with PDF Version as 2.0

Output PDF File Generated with PDF Version as 2.0

Excel library

Excel table with parameter query

The creation of Excel tables by importing data from SQL Server through Excel data connections is supported. Also,  queries can be modified at runtime with the help of parameters.

The Syncfusion Excel (XlsIO) library provides the option to set parameter values. The parameters can be set for a query either through a prompt event, as a constant, or as an Excel range.

Let’s consider a situation where you have an Excel template that contains a table with an external data connection as follows:

Excel Template with External Connection

Excel Template with External Connection

The following code example illustrates how to set the parameter through a prompt event by accessing an existing Excel table with connections.

using (ExcelEngine excelEngine = new ExcelEngine())
{
    IApplication application = excelEngine.Excel;

    //Load existing Excel template document with external connection
    IWorkbook workbook = application.Workbooks.Open("../../Data/Template.xlsx"); 
    IWorksheet worksheet = workbook.Worksheets[0];

    //Acquire the query table from the Excel table from the template document
    QueryTableImpl queryTable = worksheet.ListObjects[0].QueryTable;

    //Add a parameter
    IParameter parameter1 = queryTable.Parameters.Add("parameter1", ExcelParameterDataType.ParamTypeChar);

    //Set PROMPT parameter
    parameter1.SetParam(ExcelParameterType.Prompt, "30");
    parameter1.Prompt += new PromptEventHandler(SetParameter);

    //Update Excel query to filter data from various parameter types
    string query = "select * from Employee_Details where Emp_Age > ?;";
    queryTable.CommandText = query;

    //Refresh Excel table to filter data while loading Excel document
    if (this.refreshTable.Checked)
        worksheet.ListObjects[0].Refresh();

    workbook.SaveAs("Output.xlsx");
}

private void SetParameter(object sender, PromptEventArgs args)
{
    args.Value = 30;
}

Output File with Employee Details Filtered by Emp_Age > 30

Output File with Employee Details Filtered by Emp_Age > 30

For more information about creating external data connections and setting parameters, refer to our documentation page on external data connections.

Excel chart enhancements

Certain Excel charts provide additional features that help users visualize data more easily. Drop lines are one such feature provided in Microsoft Excel. Now, XlsIO supports the drop line feature in Excel area and line charts, which helps viewers determine the data points relative to the horizontal axis.

The following code shows how to apply drop lines in an Excel line chart.

using (ExcelEngine engine = new ExcelEngine())
{
    IApplication application = engine.Excel;
    IWorkbook workbook = application.Workbooks.Open("HighLowLinesSample.xlsx");
    IWorksheet worksheet = workbook.Worksheets[0];

    IChartShape chart = worksheet.Charts[0];
    IChartSerie chartSerie = chart.Series[0];

    chart.ChartTitle = "Drop Lines";

    //Set HasDropLines property to true.
    chartSerie.SerieFormat.CommonSerieOptions.HasDropLines = true;

    //Apply formats to DropLines.
    chartSerie.SerieFormat.CommonSerieOptions.DropLines.LineColor = Color.Red;
    chartSerie.SerieFormat.CommonSerieOptions.DropLines.LineWeight = ExcelChartLineWeight.Hairline;
    chartSerie.SerieFormat.CommonSerieOptions.DropLines.LinePattern = ExcelChartLinePattern.Dot;

    workbook.SaveAs("DropLines.xlsx");
    workbook.Close();
}

Excel Line Chart with Drop Lines

Excel Line Chart with Drop Lines

Trace precedents and dependents enhancements

Precedent cells are cells that are referred to by a formula in another cell. Dependent cells contain formulas that refer to other cells. XlsIO allows users to trace the relationship between cells and formulas in Excel workbooks, and returns the list of cells or ranges that are precedent and dependent.

In addition, XlsIO now supports getting the direct precedents and direct dependents of a worksheet or workbook. These methods return the direct precedent and dependent cells by excluding the inner precedent and dependent cells.

The GetDirectDependents() and GetDirectPrecedents() methods achieve this feature.

The following code shows how to get direct precedents.

using (ExcelEngine excelEngine = new ExcelEngine())
{
    IApplication application = excelEngine.Excel;
    IWorkbook workbook = application.Workbooks.Open("FormulaExcel.xlsx");
    IWorksheet sheet = workbook.Worksheets[0];

    //Get direct precedent cells from the worksheet
    IRange[] results1 = sheet["A1"].GetDirectPrecedents();

    //Get direct precedent cells from the workbook
    IRange[] results2 = sheet["A1"].GetDirectPrecedents(true);

    string fileName = "DirectPrecedents.xlsx";
    workbook.SaveAs(fileName);
}

The following code shows how to get direct dependents.

using (ExcelEngine excelEngine = new ExcelEngine())
{
    IApplication application = excelEngine.Excel;
    IWorkbook workbook = application.Workbooks.Open("FormulaExcel.xlsx");
    IWorksheet sheet = workbook.Worksheets[0];

    //Get direct dependent cells from the worksheet
    IRange[] results1 = sheet["A1"].GetDirectDependents();

    //Get direct dependent cells from the workbook
    IRange[] results2 = sheet["A1"].GetDirectDependents(true);

    string fileName = "DirectDependents.xlsx";
    workbook.SaveAs(fileName);
}

To learn more details about precedents and dependents, check out our documentation page, Get Precedent and Dependent Cells or Range.

Word library

Mail merge enhancements

The Syncfusion’s Word (DocIO) library now provides the following features in mail merge:

  • Event to customize clearing unmerged fields during mail merge.
  • Event to customize removing unmerged groups during mail merge.
  • Option to access the new instance (WPicture or WTextRange) replaced during mail merge.
  • Ability to execute mail merge using ADO.NET objects in ASP.NET Core and Xamarin platforms.

For more information and code examples about mail merge, refer to our documentation on working with mail merge.

Group shape

Now, you can create group shapes in Word documents (DOCX) and preserve them during DOCX-to-PDF conversion.

The following code example illustrates creating group shapes in a Word document (DOCX) and converting it to PDF.

Group Shapes in Converted PDF Document

Group Shapes in Converted PDF Document

For more information about shapes, refer to our documentation, working with shapes.

Right-to-left text rendering improvements

Right-to-left (RTL) text rendering in Word-to-PDF and Word-to-image conversions has been improved significantly.Improved RTL Text Support in Word-to-PDF Conversion

Improved RTL Text Support in Word-to-PDF Conversion

PowerPoint library

Write protection

Now, the Syncfusion PowerPoint (Presentation) library allows enabling write protection for PowerPoint presentations. With this feature, you can set write protection for a PowerPoint presentation and remove protection from an existing write-protected presentation.

The following code example illustrates how to set write protection for a PowerPoint file.

//Opens the PowerPoint presentation
IPresentation presentation = Presentation.Open("Input.pptx");
//Sets the write protection for presentation instance
presentation.SetWriteProtection("Password");
//Saves the write-protected PowerPoint presentation
presentation.Save("WriteProtection.pptx");
//Closes the presentation instance
presentation.Close();

Write-Protected PowerPoint Presentation

Write-Protected PowerPoint Presentation

To learn more about the security features of our PowerPoint library, refer to this documentation page on protecting, encrypting, and decrypting PowerPoint files.

Try it out

We believe you will love these new features and enhancements included in the 2019 Volume 2 release. Are you interested in trying them out? You can download the latest beta version from this page, or you can get our NuGet packages from nuget.org.

To get hands-on experience with the file-format libraries, check out the samples in the following GitHub locations,

If you don’t have a Syncfusion license but would like to try out these new features, you can sign up for a free 30-day trial.

If you are new to Syncfusion’s file-format libraries, we highly recommend that you follow our user guide. To get started with a specific file format, follow these links:

If you have any questions or require clarifications about these features, please let us know in the comments below. You can also contact us through our support forumDirect-Trac, or feedback portal. We are happy to assist you!

Tags:

Share this post:

Comments (1)

nice well explained

Comments are closed.

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed