Latest source merged from Syncfusion

This commit is contained in:
buildautomation 2021-10-01 11:16:34 +05:30
Родитель 1dd40bfe93
Коммит 89daa655ee
93 изменённых файлов: 7914 добавлений и 134 удалений

Двоичные данные
File-Formats/DocIO/LinuxDockerImages/Step-1.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 82 KiB

Двоичные данные
File-Formats/DocIO/LinuxDockerImages/Step-2.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 36 KiB

Двоичные данные
File-Formats/DocIO/LinuxDockerImages/Step-3.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 43 KiB

Двоичные данные
File-Formats/DocIO/LinuxDockerImages/Step-4.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 62 KiB

Двоичные данные
File-Formats/DocIO/LinuxDockerImages/Step-5.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 57 KiB

Двоичные данные
File-Formats/DocIO/LinuxDockerImages/Step-6.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 60 KiB

Двоичные данные
File-Formats/DocIO/LinuxDockerImages/Step-7.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 54 KiB

Двоичные данные
File-Formats/DocIO/LinuxDockerImages/Step-8.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 60 KiB

Двоичные данные
File-Formats/DocIO/WinUI_Images/Create_Desktop_Project.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 41 KiB

Двоичные данные
File-Formats/DocIO/WinUI_Images/Create_UWP_Project.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 48 KiB

Двоичные данные
File-Formats/DocIO/WinUI_Images/Desktop_Configure.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 19 KiB

Двоичные данные
File-Formats/DocIO/WinUI_Images/GettingStartedOutput.jpg Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 89 KiB

Двоичные данные
File-Formats/DocIO/WinUI_Images/Install_Nuget.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 27 KiB

Двоичные данные
File-Formats/DocIO/WinUI_Images/Target_Version.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 20 KiB

Двоичные данные
File-Formats/DocIO/WinUI_Images/UWP_Configure.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 20 KiB

Просмотреть файл

@ -1275,6 +1275,15 @@ cell.CellFormat.Paddings.All = 5;
cell.CellFormat.VerticalAlignment = VerticalAlignment.Middle;
//Disables the text wrap option to avoid displaying longer text on multiple lines
cell.CellFormat.TextWrap = false;
//Access the instance of the third cell in the row
cell = row.Cells[2];
//Set color for tablecell borders
cell.CellFormat.Borders.BorderType = BorderStyle.Thick;
cell.CellFormat.Borders.Color = Color.Red;
cell.CellFormat.Borders.Top.Color = Color.Red;
cell.CellFormat.Borders.Bottom.Color = Color.Red;
cell.CellFormat.Borders.Right.Color = Color.Red;
cell.CellFormat.Borders.Left.Color = Color.Red;
//Saves and closes the document instance
document.Save("TableCellFormatting.docx", FormatType.Docx);
document.Close();
@ -1318,6 +1327,15 @@ cell.CellFormat.Paddings.All = 5
cell.CellFormat.VerticalAlignment = VerticalAlignment.Middle
'Disables the text wrap option to avoid displaying longer text on multiple lines
cell.CellFormat.TextWrap = False
'Access the instance of the third cell in the row
cell = row.Cells(2)
'Set color for tablecell borders
cell.CellFormat.Borders.BorderType = BorderStyle.Thick
cell.CellFormat.Borders.Color = Color.Red
cell.CellFormat.Borders.Top.Color = Color.Red
cell.CellFormat.Borders.Bottom.Color = Color.Red
cell.CellFormat.Borders.Right.Color = Color.Red
cell.CellFormat.Borders.Left.Color = Color.Red
'Saves and closes the document instance
document.Save("TableCellFormatting.docx", FormatType.Docx)
document.Close()
@ -1362,6 +1380,15 @@ cell.CellFormat.Paddings.All = 5;
cell.CellFormat.VerticalAlignment = VerticalAlignment.Middle;
//Disables the text wrap option to avoid displaying longer text on multiple lines
cell.CellFormat.TextWrap = false;
//Access the instance of the third cell in the row
cell = row.Cells[2];
//Set color for tablecell borders
cell.CellFormat.Borders.BorderType = BorderStyle.Thick;
cell.CellFormat.Borders.Color = Color.Red;
cell.CellFormat.Borders.Top.Color = Color.Red;
cell.CellFormat.Borders.Bottom.Color = Color.Red;
cell.CellFormat.Borders.Right.Color = Color.Red;
cell.CellFormat.Borders.Left.Color = Color.Red;
//Saves the Word file to MemoryStream
MemoryStream stream = new MemoryStream();
await document.SaveAsync(stream, FormatType.Docx);
@ -1411,6 +1438,15 @@ cell.CellFormat.Paddings.All = 5;
cell.CellFormat.VerticalAlignment = VerticalAlignment.Middle;
//Disables the text wrap option to avoid displaying longer text on multiple lines
cell.CellFormat.TextWrap = false;
//Access the instance of the third cell in the row
cell = row.Cells[2];
//Set color for tablecell borders
cell.CellFormat.Borders.BorderType = BorderStyle.Thick;
cell.CellFormat.Borders.Color = Color.Red;
cell.CellFormat.Borders.Top.Color = Color.Red;
cell.CellFormat.Borders.Bottom.Color = Color.Red;
cell.CellFormat.Borders.Right.Color = Color.Red;
cell.CellFormat.Borders.Left.Color = Color.Red;
//Saves the Word document to MemoryStream
MemoryStream stream = new MemoryStream();
document.Save(stream, FormatType.Docx);
@ -1460,6 +1496,15 @@ cell.CellFormat.Paddings.All = 5;
cell.CellFormat.VerticalAlignment = VerticalAlignment.Middle;
//Disables the text wrap option to avoid displaying longer text on multiple lines
cell.CellFormat.TextWrap = false;
//Access the instance of the third cell in the row
cell = row.Cells[2];
//Set color for tablecell borders
cell.CellFormat.Borders.BorderType = BorderStyle.Thick;
cell.CellFormat.Borders.Color = Color.Red;
cell.CellFormat.Borders.Top.Color = Color.Red;
cell.CellFormat.Borders.Bottom.Color = Color.Red;
cell.CellFormat.Borders.Right.Color = Color.Red;
cell.CellFormat.Borders.Left.Color = Color.Red;
//Saves the Word document to MemoryStream
MemoryStream stream = new MemoryStream();
document.Save(stream, FormatType.Docx);

Просмотреть файл

@ -2498,6 +2498,180 @@ pdfDocument.Close();
{% endtabs %}
### Comments in Word-to-PDF conversion
The following code sample shows how to **preserve comments balloon in a generated PDF** when converting Word documents with comments. Also you can customize how comments balloon color appears in a generated PDF.
{% tabs %}
{% highlight c# %}
//Loads an existing Word document.
using (WordDocument wordDocument = new WordDocument("Template.docx", FormatType.Docx))
{
//Sets ShowInBalloons to render a document comments in converted PDF document.
wordDocument.RevisionOptions.CommentDisplayMode = CommentDisplayMode.ShowInBalloons;
//Sets the color to be used for Comment Balloon.
wordDocument.RevisionOptions.CommentColor = RevisionColor.Blue;
//Initializes the ChartToImageConverter for converting charts during Word to pdf conversion.
wordDocument.ChartToImageConverter = new ChartToImageConverter();
//Sets the scaling mode for charts.
wordDocument.ChartToImageConverter.ScalingMode = ScalingMode.Normal;
//Creates an instance of the DocToPDFConverter.
using (DocToPDFConverter converter = new DocToPDFConverter())
{
//Converts Word document into PDF document.
using (PdfDocument pdfDocument = converter.ConvertToPDF(wordDocument))
{
//Saves the PDF file to file system.
pdfDocument.Save("Sample.pdf");
}
}
}
{% endhighlight %}
{% highlight vb.net %}
'Loads an existing Word document.
Using wordDocument As WordDocument = New WordDocument("Template.docx", FormatType.Docx)
'Sets ShowInBalloons to render a document comments in converted PDF document.
wordDocument.RevisionOptions.CommentDisplayMode = CommentDisplayMode.ShowInBalloons
'Sets the color to be used for Comment Balloon.
wordDocument.RevisionOptions.CommentColor = RevisionColor.Blue
'Initializes the ChartToImageConverter for converting charts during Word to pdf conversion.
wordDocument.ChartToImageConverter = New ChartToImageConverter
'Sets the scaling mode for charts.
wordDocument.ChartToImageConverter.ScalingMode = ScalingMode.Normal
'Creates an instance of the DocToPDFConverter.
Using converter As New DocToPDFConverter()
'Converts Word document into PDF document.
Using pdfDocument As PdfDocument = converter.ConvertToPDF(wordDocument)
'Saves the PDF file to file system.
pdfDocument.Save("Sample.pdf")
End Using
End Using
End Using
{% endhighlight %}
{% highlight UWP %}
//"App" is the class of Portable project.
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
//Loads an existing Word document.
using (WordDocument wordDocument = new WordDocument((assembly.GetManifestResourceStream("Sample.Assets.Template.docx")),FormatType.Docx))
{
//Sets ShowInBalloons to render a document comments in converted PDF document.
wordDocument.RevisionOptions.CommentDisplayMode = CommentDisplayMode.ShowInBalloons;
//Sets the color to be used for Comment Balloon.
wordDocument.RevisionOptions.CommentColor = RevisionColor.Blue;
//Creates an instance of DocIORenderer.
using (DocIORenderer docIORenderer = new DocIORenderer())
{
//Converts Word document into PDF document.
using (PdfDocument pdfDocument = docIORenderer.ConvertToPDF(wordDocument))
{
//Save the document into stream.
using (MemoryStream stream = new MemoryStream())
{
pdfDocument.Save(stream);
//Save the stream as PDF document file in local machine. Refer to PDF/UWP section for respected code samples.
Save(stream, "Sample.pdf");
}
}
}
}
//Saves the PDF document.
async void Save(MemoryStream streams, string filename)
{
streams.Position = 0;
StorageFile stFile;
if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.DefaultFileExtension = ".pdf";
savePicker.SuggestedFileName = filename;
savePicker.FileTypeChoices.Add("Word Documents", new List<string>() { ".pdf" });
stFile = await savePicker.PickSaveFileAsync();
}
else
{
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
stFile = await local.CreateFileAsync(filename, CreationCollisionOption.ReplaceExisting);
}
if (stFile != null)
{
using (IRandomAccessStream zipStream = await stFile.OpenAsync(FileAccessMode.ReadWrite))
{
//Write compressed data from memory to file.
using (Stream outstream = zipStream.AsStreamForWrite())
{
byte[] buffer = streams.ToArray();
outstream.Write(buffer, 0, buffer.Length);
outstream.Flush();
}
}
}
//Launch the saved Word file.
await Windows.System.Launcher.LaunchFileAsync(stFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (FileStream fileStream = new FileStream("Template.docx", FileMode.Open))
{
//Loads an existing Word document.
using (WordDocument wordDocument = new WordDocument(fileStream,FormatType.Docx))
{
//Sets ShowInBalloons to render a document comments in converted PDF document.
wordDocument.RevisionOptions.CommentDisplayMode = CommentDisplayMode.ShowInBalloons;
//Sets the color to be used for Comment Balloon.
wordDocument.RevisionOptions.CommentColor = RevisionColor.Blue;
//Creates an instance of DocIORenderer.
using (DocIORenderer renderer = new DocIORenderer())
{
//Converts Word document into PDF document.
using (PdfDocument pdfDocument = renderer.ConvertToPDF(wordDocument))
{
//Saves the PDF file to file system.
using (FileStream outputStream = new FileStream("Sample.pdf", FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
{
pdfDocument.Save(outputStream);
}
}
}
}
}
{% endhighlight %}
{% highlight Xamarin %}
//"App" is the class of Portable project
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
//Opens an existing wod document
using (WordDocument wordDocument = new WordDocument(assembly.GetManifestResourceStream("Sample.Assets.Template.docx"), FormatType.Automatic))
{
//Sets ShowInBalloons to render a document comments in converted PDF document.
wordDocument.RevisionOptions.CommentDisplayMode = CommentDisplayMode.ShowInBalloons;
//Sets the color to be used for Comment Balloon.
wordDocument.RevisionOptions.CommentColor = RevisionColor.Blue;
//Creates an instance of DocIORenderer.
using (DocIORenderer docIORenderer = new DocIORenderer())
{
//Converts Word document into PDF document.
using (PdfDocument pdfDocument = docIORenderer.ConvertToPDF(wordDocument))
{
//Saves the Word document to MemoryStream
using (MemoryStream stream = new MemoryStream())
{
pdfDocument.Save(stream);
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("Sample.pdf", "application/pdf", stream);
//Please download the helper files from the below link to save the stream as file and open the file for viewing in Xamarin platform
//https://help.syncfusion.com/file-formats/docio/create-word-document-in-xamarin#helper-files-for-xamarin
}
}
}
}
{% endhighlight %}
{% endtabs %}
### Preserve Ole Equation as bitmap image
This setting allows you to preserve Ole Equation as bitmap image in the converted PDF document.
@ -3110,14 +3284,6 @@ Not supported
</tr>
<tr>
<td>
Comments
</td>
<td>
Not supported
</td>
</tr>
<tr>
<td>
Vertical Alignment of the section
</td>
<td>

Просмотреть файл

@ -2,7 +2,7 @@
layout: post
title: License Key Errors of Essential Studio | Syncfusion
description: Learn here some information about how to fix Syncfusion license key related errors and more details.
platform: common
platform: file-formats
control: Essential Studio
documentation: ug
---

Просмотреть файл

@ -2,7 +2,7 @@
layout: post
title: Licensing FAQ – Upgrade from Trial version | Syncfusion
description: Learn here some information about upgrading from trial version of Essential Studio to Licensed version.
platform: common
platform: file-formats
control: Essential Studio
documentation: ug
---

Просмотреть файл

@ -2,7 +2,7 @@
layout: post
title: About Essential Studio Licensing | Syncfusion
description: Learn here about Syncfusion Essential Studio license key, how to generate the license key, how to register the license key, and more details.
platform: common
platform: file-formats
control: Essential Studio
documentation: ug
---

Просмотреть файл

@ -2,7 +2,7 @@
layout: post
title: Licensing FAQ – Get the license key | Syncfusion
description: Learn here some information about recommended places to register the Syncfusion license key in your application.
platform: common
platform: file-formats
control: Essential Studio
documentation: ug
---

Просмотреть файл

@ -1945,3 +1945,118 @@ return File(stream, contentType, fileName);
{% endtabs %}
N> 1. Essential PDF supports converting TIFF to PDF with [Syncfusion.Pdf.Imaging.Portable](https://www.nuget.org/packages/Syncfusion.Pdf.Imaging.Net.Core) assembly reference in ASP.NET Core.
## Remove Images
The RemoveImage method of the page collection allows you to remove an image. You can remove images from an existing document using Essential PDF.
The code snippet to illustrate the same is given below.
{% tabs %}
{% highlight c# %}
//Load a PDF document
PdfLoadedDocument doc = new PdfLoadedDocument("input.pdf");
//Load the first page
PdfPageBase pageBase = doc.Pages[0];
//Extract images from the first page
PdfImageInfo imageInfo = pageBase.ImagesInfo[0];
//Remove the Image
pageBase.RemoveImage(imageInfo);
//Save the document
doc.Save("Output.pdf");
//Close the document
doc.Close(true);
{% endhighlight %}
{% highlight vb.net %}
'Load an existing PDF
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Load the first page
Dim pageBase As PdfPageBase = loadedDocument.Pages(0)
'Extract images from the first page
Dim imageInfo As PdfImageInfo = pageBase.ImagesInfo(0)
'Remove the Image
pageBase.RemoveImage(imageInfo)
Dim stream As New MemoryStream()
'Save the document
loadedDocument.Save(stream)
'Close the document
loadedDocument.Close(True)
{% endhighlight %}
{% highlight UWP %}
//Essential PDF supports remove image from the existing PDF document only in Windows Forms, WPF, ASP.NET, ASP.NET MVC platforms.
{% endhighlight %}
{% highlight ASP.NET Core %}
//Load an existing PDF.
FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
//Load the first page.
PdfPageBase pageBase = loadedDocument.Pages[0];
//Extract images from the first page.
PdfImageInfo[] imageInfo = loadedDocument.Pages[0].GetImagesInfo();
//Remove the Image.
pageBase.RemoveImage(imageInfo[0]);
//Create the stream object
MemoryStream stream = new MemoryStream();
//Save the document into stream
loadedDocument.Save(stream);
//If the position is not set to '0' then the PDF will be empty
stream.Position = 0;
//Close the document
loadedDocument.Close(true);
//Define the ContentType for pdf file
string contentType = "application/pdf";
//Define the file name
string fileName = "Output.pdf";
//Create a FileContentResult object by using the file contents, content type and file name
return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight Xamarin %}
//Essential PDF supports remove image from the existing PDF document only in Windows Forms, WPF, ASP.NET, ASP.NET MVC platforms.
{% endhighlight %}
{% endtabs %}
N> 1. Essential PDF supports remove image from the existing PDF document with Syncfusion.Pdf.Imaging.Portable assembly reference in ASP.NET Core.

Просмотреть файл

@ -2518,4 +2518,111 @@ loadedDocument.Close(true);
{% endhighlight %}
{% endtabs %}
{% endtabs %}
## Get PDF to PDF/A conversion progress
You can get conversion progress using PdfAConversionProgress event.
The following code sample shows the delegate for handling PDF to PDF/A conversion process
{% tabs %}
{% highlight c# %}
//Load a PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
// Set the conformance for PDF/A-1b conversion.
loadedDocument.Conformance = PdfConformanceLevel.Pdf_A1B;
loadedDocument.PdfAConversionProgress += pdfAConversion_TrackProgress;
//Save the document
loadedDocument.Save("Output.pdf");
//Close the document
loadedDocument.Close(true);
//Event handler for Track PDF to PDF/A conversion process
void pdfAConversion_TrackProgress(object sender, PdfAConversionProgressEventArgs arguments)
{
MessageBox.Show(String.Format("PDF to PDF/A conversion Process " + arguments. ProgressValue + " % completed"));
}
{% endhighlight %}
{% highlight vb.net %}
' Load a PDF document
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
' Set the conformance for PDF/A-1b conversion.
loadedDocument.Conformance = PdfConformanceLevel.Pdf_A1B
loadedDocument.PdfAConversionProgress += pdfAConversion_TrackProgress
'Save the document
loadedDocument.Save("Output.pdf")
'Close the document
loadedDocument.Close(True)
'Event handler for Track PDF to PDF/A conversion process
Private Sub pdfAConversion_TrackProgress(ByVal sender As Object, ByVal arguments As PdfAConversionProgressEventArgs)
MessageBox.Show(String.Format(PDF to PDF/A conversion Process " + arguments. ProgressValue + " % completed"))
{% endhighlight %}
{% highlight ASP.NET Core %}
//Load an existing PDF.
FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
// Set the conformance for PDF/A-1b conversion.
loadedDocument.Conformance = PdfConformanceLevel.Pdf_A1B;
loadedDocument.PdfAConversionProgress += pdfAConversion_TrackProgress;
//Creating the stream object
MemoryStream stream = new MemoryStream();
//Save the document into stream
loadedDocument.Save(stream);
//If the position is not set to '0' then the PDF will be empty
loadedDocument.Position = 0;
//Close the document
loadedDocument.Close(true);
//Event handler for Track PDF to PDF/A conversion process
void pdfAConversion_TrackProgress(object sender, PdfAConversionProgressEventArgs arguments)
{
MessageBox.Show(String.Format("PDF to PDF/A conversion Process " + arguments. ProgressValue + " % completed"));
}
//Defining the ContentType for pdf file
string contentType = "application/pdf";
//Define the file name
string fileName = "Output.pdf";
//Creates a FileContentResult object by using the file contents, content type, and file name
return File(stream, contentType, fileName);
{% endhighlight %}
{% endtabs %}

Просмотреть файл

@ -946,3 +946,273 @@ return File(stream, contentType, fileName);
{% endhighlight %}
{% endtabs %}
## Get redaction progress
You can get the redaction process using TrackRedactionProgress event.
The code snippet to illustrate the same is given below.
{% tabs %}
{% highlight c# %}
//Load a PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
//Load the first page
PdfLoadedPage page = loadedDocument.Pages[0] as PdfLoadedPage ;
PdfRedaction redaction = new PdfRedaction(new RectangleF(37, 94, 50, 10), System.Drawing.Color.Black);
//Add redaction to the loaded page
page.Redactions.Add(redaction);
loadedDocument.RedactionProgress += redaction_TrackProgress;
//Save the document
loadedDocument.Save("Output.pdf");
//Close the document
loadedDocument.Close(true);
//Event handler for Track redaction process
void redaction_TrackProgress(object sender, RedactionProgressEventArgs arguments)
{
MessageBox.Show(String.Format("Redaction Process " + arguments.Progress + " % completed"));
}
{% endhighlight %}
{% highlight vb.net %}
'Load an existing PDF
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Load the first page
Dim page As PdfLoadedPage = loadedDocument.Pages(0) as PdfLoadedPage
Dim redaction As PdfRedaction = New PdfRedaction(New RectangleF(37,94,50,10),System.Drawing.Color.Black)
'Add redaction to the loaded page
page.Redactions.Add(redaction)
loadedDocument.RedactionProgress += redaction_TrackProgress
Dim stream As New MemoryStream()
'Save the document
loadedDocument.Save(stream)
'Close the document
loadedDocument.Close(True)
'Event handler for Track redaction process
Private Sub redaction_TrackProgress(ByVal sender As Object, ByVal arguments As RedactionProgressEventArgs)
MessageBox.Show(String.Format("Redaction Process " + arguments.Progress + " % completed"))
{% endhighlight %}
{% highlight UWP %}
//PDF supports redaction only in Windows Forms, WPF, ASP.NET, ASP.NET MVC.
{% endhighlight %}
{% highlight ASP.NET Core %}
//Load an existing PDF.
FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
//Load the first page.
PdfLoadedPage page = loadedDocument.Pages[0] as PdfLoadedPage;
PdfRedaction redaction = new PdfRedaction(new RectangleF(37, 94, 50, 10), System.Drawing.Color.Black);
//Add redaction to the loaded page
page.AddRedaction(redaction);
loadedDocument.RedactionProgress += redaction_TrackProgress;
//Create the stream object
MemoryStream stream = new MemoryStream();
//Save the document into stream
loadedDocument.Save(stream);
//If the position is not set to '0' then the PDF will be empty
stream.Position = 0;
//Close the document
loadedDocument.Close(true);
// Event handler for Track redaction process
void redaction_TrackProgress(object sender, RedactionProgressEventArgs arguments)
{
MessageBox.Show(String.Format("Redaction Process " + arguments.Progress + " % completed"));
}
//Define the ContentType for pdf file
string contentType = "application/pdf";
//Define the file name
string fileName = "Output.pdf";
//Create a FileContentResult object by using the file contents, content type, and file name
return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight Xamarin %}
//PDF supports redaction only in Windows Forms, WPF, ASP.NET, ASP.NET MVC Platforms.
{% endhighlight %}
{% endtabs %}
## Redaction result
Using PdfRedactionResult, you can get the status of the redaction with other information. The result of the redaction operation can be obtained using Essential PDF.
The code snippet to illustrate the same is given below.
{% tabs %}
{% highlight c# %}
PdfLoadedDocument lDoc = new PdfLoadedDocument("input.pdf");
//Load the first page
PdfLoadedPage page = lDoc.Pages[0] as PdfLoadedPage;
PdfRedaction redaction = new PdfRedaction(new RectangleF(37, 94, 50, 10), System.Drawing.Color.Black);
//Add redaction object into redaction collection of loaded page
page.Redactions.Add(redaction);
//Redact the contents from PDF document.
List<PdfRedactionResult> redactionResults = lDoc.Redact();
foreach(PdfRedactionResult result in redactionResults)
{
if (result.IsRedactionSuccess)
Console.WriteLine("Content redacted successfully...");
else
Console.WriteLine("Content not redacted properly...");
}
//Save the document
lDoc.Save("Output.pdf");
//Close the document
lDoc.Close(true);
{% endhighlight %}
{% highlight vb.net %}
'Load an existing PDF
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Load the first page
Dim page As PdfLoadedPage = loadedDocument.Pages(0) as PdfLoadedPage
Dim redaction As PdfRedaction = New PdfRedaction(New RectangleF(37,94,50,10),System.Drawing.Color.Black)
'Add redaction to the loaded page
page.Redactions.Add(redaction)
'Redact the contents from PDF document
Dim results As List<PdfRedactionResult> = loadedDocument.Redact();
For Each result As PdfRedactionResult In redactionResults
If result.IsRedactionSuccess Then
Console.WriteLine("Content redacted successfully...")
Else
Console.WriteLine("Content not redacted properly...")
End If
Next
Dim stream As New MemoryStream()
'Save the document
loadedDocument.Save(stream)
'Close the document
loadedDocument.Close(True)
{% endhighlight %}
{% highlight UWP %}
//PDF supports redaction only in Windows Forms, WPF, ASP.NET, ASP.NET MVC.
{% endhighlight %}
{% highlight ASP.NET Core %}
//Load an existing PDF.
FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
//Load the first page.
PdfLoadedPage page = loadedDocument.Pages[0];
PdfRedaction redaction = new PdfRedaction(new RectangleF(37, 94, 50, 10), System.Drawing.Color.Black);
//Add redaction to the loaded page
page.AddRedaction(redaction);
//Redact the contents from PDF document
List<PdfRedactionResult> results = loadedDocument.Redact();
foreach(PdfRedactionResult result in redactionResults)
{
if (result.IsRedactionSuccess)
Console.WriteLine("Content redacted successfully...");
else
Console.WriteLine("Content not redacted properly...");
}
//Create the stream object
MemoryStream stream = new MemoryStream();
//Save the document into stream
loadedDocument.Save(stream);
//If the position is not set to '0' then the PDF will be empty
stream.Position = 0;
//Close the document
loadedDocument.Close(true);
//Define the ContentType for pdf file
string contentType = "application/pdf";
//Define the file name
string fileName = "Output.pdf";
//Create a FileContentResult object by using the file contents, content type, and file name
return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight Xamarin %}
//PDF supports redaction only in Windows Forms, WPF, ASP.NET, ASP.NET MVC Platforms.
{% endhighlight %}
{% endtabs %}

Просмотреть файл

@ -16,73 +16,81 @@ The following code example demonstrates how to encrypt a PowerPoint Presentation
{% tabs %}
{% highlight c# %}
//Creates an instance for Presentation
IPresentation presentation = Presentation.Create();
//Adds slide to Presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Adds textbox to slide
IShape shape = slide.Shapes.AddTextBox(100, 30, 200, 300);
//Adds a paragraph with text content.
IParagraph paragraph = shape.TextBody.AddParagraph("Password Protected.");
//Protects the file with password
presentation.Encrypt("PASSWORD!@1#$");
//Saves the Presentation
presentation.Save("Sample.pptx");
//Closes the Presentation
presentation.Close();
//Creates an instance for Presentation.
using (IPresentation presentation = Presentation.Create())
{
//Adds slide to Presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Adds textbox to slide.
IShape shape = slide.Shapes.AddTextBox(100, 30, 200, 300);
//Adds a paragraph with text content.
IParagraph paragraph = shape.TextBody.AddParagraph("Password Protected.");
//Protects the file with password.
presentation.Encrypt("PASSWORD!@1#$");
//Saves the Presentation.
presentation.Save("Sample.pptx");
}
{% endhighlight %}
{% highlight vb.net %}
'Creates an instance for Presentation.
Using presentationDocument As IPresentation = Presentation.Create()
'Adds slide to Presentation.
Dim slide As ISlide = presentationDocument.Slides.Add(SlideLayoutType.Blank)
'Adds textbox to slide.
Dim shape As IShape = slide.Shapes.AddTextBox(100, 30, 200, 300)
'Adds a paragraph with text content.
Dim paragraph As IParagraph = shape.TextBody.AddParagraph("Password Protected.")
'Protects the file with password.
presentationDocument.Encrypt("PASSWORD!@1#$")
'Saves the Presentation.
presentationDocument.Save("Sample.pptx")
End Using
{% endhighlight %}
'Creates an instance for Presentation
Dim presentationDocument As IPresentation = Presentation.Create()
'Adds slide to Presentation
Dim slide As ISlide = presentationDocument.Slides.Add(SlideLayoutType.Blank)
'Adds textbox to slide
Dim shape As IShape = slide.Shapes.AddTextBox(100, 30, 200, 300)
'Adds a paragraph with text content.
Dim paragraph As IParagraph = shape.TextBody.AddParagraph("Password Protected.")
'Protects the file with password
presentationDocument.Encrypt("PASSWORD!@1#$")
'Saves the Presentation
presentationDocument.Save("Sample.pptx")
'Closes the Presentation
presentationDocument.Close()
{% highlight ASP.NET CORE %}
using (IPresentation presentation = Presentation.Create())
{
//Adds slide to Presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Adds textbox to slide.
IShape shape = slide.Shapes.AddTextBox(100, 30, 200, 300);
//Adds a paragraph with text content.
IParagraph paragraph = shape.TextBody.AddParagraph("Password Protected.");
//Protects the file with password.
presentation.Encrypt("PASSWORD!@1#$");
//Save the PowerPoint Presentation as stream.
using (FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create))
{
presentation.Save(outputStream);
}
}
{% endhighlight %}
{% highlight XAMARIN %}
//Creates an instance for Presentation.
using (IPresentation presentation = Presentation.Create())
{
//Adds slide to Presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Adds textbox to slide.
IShape shape = slide.Shapes.AddTextBox(100, 30, 200, 300);
//Adds a paragraph with text content.
IParagraph paragraph = shape.TextBody.AddParagraph("Password Protected.");
//Protects the file with password.
presentation.Encrypt("PASSWORD!@1#$");
//Save the PowerPoint to stream in pptx format.
using (MemoryStream stream = new MemoryStream())
{
presentation.Save(stream);
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("Sample.pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation", stream);
}
}
{% endhighlight %}
{% endtabs %}
N> PowerPoint Presentation doesn't support encryption in ASP.NET Core, Blazor and Xamarin.
## Decrypting the PowerPoint Presentation
Essential Presentation provides ability to remove the encryption from the PowerPoint Presentation. You can decrypt a PowerPoint Presentation by opening it with the password.
@ -94,35 +102,51 @@ The following code example demonstrates opening the encrypted PowerPoint Present
{% tabs %}
{% highlight c# %}
//Opens an existing Presentation from file system and it can be decrypted by using the provided password.
IPresentation presentation = Presentation.Open("Sample.pptx", "PASSWORD!@1#$");
//Saves the Presentation
presentation.Save("Output.pptx");
//Closes the Presentation
presentation.Close();
using (IPresentation presentation = Presentation.Open("Sample.pptx", "PASSWORD!@1#$"))
{
//Saves the Presentation.
presentation.Save("Output.pptx");
}
{% endhighlight %}
{% highlight vb.net %}
'Opens an existing Presentation from file system and it can be decrypted by using the provided password.
Using presentationDocument As IPresentation = Presentation.Open("Sample.pptx", "PASSWORD!@1#$")
'Saves the Presentation
presentationDocument.Save("Output.pptx")
End Using
{% endhighlight %}
Dim presentationDocument As IPresentation = Presentation.Open("Sample.pptx", "PASSWORD!@1#$")
'Saves the Presentation
presentationDocument.Save("Output.pptx")
'Closes the Presentation
presentationDocument.Close()
{% highlight ASP.NET CORE %}
//Opens an existing Presentation from file system and it can be decrypted by using the provided password.
using (FileStream inputStream = new FileStream("Sample.pptx", FileMode.Open))
{
using (IPresentation presentation = Presentation.Open(inputStream, "PASSWORD!@1#$"))
{
//Save the PowerPoint Presentation as stream.
using (FileStream outputStream = new FileStream("Output.pptx", FileMode.Create))
{
presentation.Save(outputStream);
}
}
}
{% endhighlight %}
{% highlight XAMARIN %}
//"App" is the class of Portable project
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
//Loads or open an existing PowerPoint Presentation
using (IPresentation presentation = Presentation.Open(assembly.GetManifestResourceStream("Sample.Assets.Sample.pptx"), "PASSWORD!@1#$"))
{
//Save the PowerPoint to stream in pptx format.
using (MemoryStream stream = new MemoryStream())
{
presentation.Save(stream);
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("Sample.pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation", stream);
}
}
{% endhighlight %}
{% endtabs %}
@ -134,45 +158,61 @@ The following code example demonstrates removing the encryption from a PowerPoin
{% tabs %}
{% highlight c# %}
//Opens an existing Presentation from file system and it can be decrypted by using the provided password.
IPresentation presentation = Presentation.Open("Sample.pptx", "PASSWORD!@1#$");
//Decrypts the document
presentation.RemoveEncryption();
//Saves the presentation
presentation.Save("Output.pptx");
//Closes the Presentation
presentation.Close();
using (IPresentation presentation = Presentation.Open("Sample.pptx", "PASSWORD!@1#$"))
{
//Decrypts the document.
presentation.RemoveEncryption();
//Saves the presentation.
presentation.Save("Output.pptx");
}
{% endhighlight %}
{% highlight vb.net %}
'Opens an existing Presentation from file system and it can be decrypted by using the provided password.
Dim presentationDocument As IPresentation = Presentation.Open("Sample.pptx", "PASSWORD!@1#$")
'Decrypts the document
presentationDocument.RemoveEncryption()
'Saves the Presentation
presentationDocument.Save("Output.pptx")
'Closes the Presentation
presentationDocument.Close()
Using presentationDocument As IPresentation = Presentation.Open("Sample.pptx", "PASSWORD!@1#$")
'Decrypts the document.
presentationDocument.RemoveEncryption()
'Saves the Presentation.
presentationDocument.Save("Output.pptx")
End Using
{% endhighlight %}
{% highlight ASP.NET CORE %}
//Opens an existing Presentation from file system and it can be decrypted by using the provided password.
using (FileStream inputStream = new FileStream("Sample.pptx", FileMode.Open))
{
//Opens an existing Presentation from file system and it can be decrypted by using the provided password.
using (IPresentation presentation = Presentation.Open(inputStream, "PASSWORD!@1#$"))
{
//Decrypts the document.
presentation.RemoveEncryption();
//Save the PowerPoint Presentation as stream.
using (FileStream outputStream = new FileStream("Output.pptx", FileMode.Create))
{
presentation.Save(outputStream);
}
}
}
{% endhighlight %}
{% highlight XAMARIN %}
//"App" is the class of Portable project
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
//Loads or open an existing PowerPoint Presentation
using (IPresentation presentation = Presentation.Open(assembly.GetManifestResourceStream("GettingStarted.Assets.Sample.pptx"), "PASSWORD!@1#$"))
{
//Decrypts the document.
presentation.RemoveEncryption();
//Save the PowerPoint to stream in pptx format.
using (MemoryStream stream = new MemoryStream())
{
presentation.Save(stream);
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("Sample.pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation", stream);
}
}
{% endhighlight %}
{% endtabs %}
## Write Protection
@ -501,6 +541,6 @@ else
{% endtabs %}
N> 1. In Xamarin application, this feature is supported from the target framework .NET Standard 2.0 version onwards.
N> 2. For ASP.NET Core, this feature is supported from .NET Core 2.0 version onwards.
N> 1. In Xamarin applications, Encryption, Decryption and Write Protection features are supported from the target framework .NET Standard 2.0 version onwards.
N> 2. For ASP.NET Core, Encryption, Decryption and Write Protection features are supported from the .NET Core 2.0 version onwards.

Просмотреть файл

@ -480,19 +480,19 @@ Yes
Yes
</td>
<td>
No
</td>
<td>
No
Yes
</td>
<td>
Yes
</td>
<td>
No
Yes
</td>
<td>
No
Yes
</td>
<td>
Yes
</td>
</tr>
<tr>

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 41 KiB

Двоичные данные
File-Formats/Presentation/Workingwith_WinUI/Create_UWP_Project.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 48 KiB

Двоичные данные
File-Formats/Presentation/Workingwith_WinUI/Desktop_Configure.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 38 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 53 KiB

Двоичные данные
File-Formats/Presentation/Workingwith_WinUI/Install_Nuget.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 35 KiB

Двоичные данные
File-Formats/Presentation/Workingwith_WinUI/Target_Version.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 20 KiB

Двоичные данные
File-Formats/Presentation/Workingwith_WinUI/UWP_Configure.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 20 KiB

Просмотреть файл

@ -0,0 +1,73 @@
---
title : Essential Studio for File Formats Weekly Nuget Release Release Notes
description : Essential Studio for File Formats Weekly Nuget Release Release Notes
platform : file-formats
documentation: ug
---
# Essential Studio for File Formats Release Notes
{% include release-info.html date="May 25, 2021" version="v19.1.0.65" %}
## DocIO
* [ASP.NET Release Notes](/aspnet/release-notes/v19.1.0.65
#docio){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.1.0.65
#docio){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.1.0.65
#docio){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.1.0.65
#docio){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.1.0.65
#docio){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.1.0.65
#docio){:target="_blank"}
## PDF
* [ASP.NET Release Notes](/aspnet/release-notes/v19.1.0.65
#pdf){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.1.0.65
#pdf){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.1.0.65
#pdf){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.1.0.65
#pdf){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.1.0.65
#pdf){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.1.0.65
#pdf){:target="_blank"}
## Presentation
* [ASP.NET Release Notes](/aspnet/release-notes/v19.1.0.65
#presentation){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.1.0.65
#presentation){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.1.0.65
#presentation){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.1.0.65
#presentation){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.1.0.65
#presentation){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.1.0.65
#presentation){:target="_blank"}
## XlsIO
* [ASP.NET Release Notes](/aspnet/release-notes/v19.1.0.65
#xlsio){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.1.0.65
#xlsio){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.1.0.65
#xlsio){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.1.0.65
#xlsio){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.1.0.65
#xlsio){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.1.0.65
#xlsio){:target="_blank"}

Просмотреть файл

@ -0,0 +1,73 @@
---
title : Essential Studio for File Formats Weekly Nuget Release Release Notes
description : Essential Studio for File Formats Weekly Nuget Release Release Notes
platform : file-formats
documentation: ug
---
# Essential Studio for File Formats Release Notes
{% include release-info.html date="June 01, 2021" version="v19.1.0.66" %}
## DocIO
* [ASP.NET Release Notes](/aspnet/release-notes/v19.1.0.66
#docio){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.1.0.66
#docio){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.1.0.66
#docio){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.1.0.66
#docio){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.1.0.66
#docio){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.1.0.66
#docio){:target="_blank"}
## PDF
* [ASP.NET Release Notes](/aspnet/release-notes/v19.1.0.66
#pdf){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.1.0.66
#pdf){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.1.0.66
#pdf){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.1.0.66
#pdf){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.1.0.66
#pdf){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.1.0.66
#pdf){:target="_blank"}
## Presentation
* [ASP.NET Release Notes](/aspnet/release-notes/v19.1.0.66
#presentation){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.1.0.66
#presentation){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.1.0.66
#presentation){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.1.0.66
#presentation){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.1.0.66
#presentation){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.1.0.66
#presentation){:target="_blank"}
## XlsIO
* [ASP.NET Release Notes](/aspnet/release-notes/v19.1.0.66
#xlsio){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.1.0.66
#xlsio){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.1.0.66
#xlsio){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.1.0.66
#xlsio){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.1.0.66
#xlsio){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.1.0.66
#xlsio){:target="_blank"}

Просмотреть файл

@ -0,0 +1,73 @@
---
title : Essential Studio for File Formats Weekly Nuget Release Release Notes
description : Essential Studio for File Formats Weekly Nuget Release Release Notes
platform : file-formats
documentation: ug
---
# Essential Studio for File Formats Release Notes
{% include release-info.html date="June 08, 2021" version="v19.1.0.67" %}
## DocIO
* [ASP.NET Release Notes](/aspnet/release-notes/v19.1.0.67
#docio){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.1.0.67
#docio){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.1.0.67
#docio){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.1.0.67
#docio){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.1.0.67
#docio){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.1.0.67
#docio){:target="_blank"}
## PDF
* [ASP.NET Release Notes](/aspnet/release-notes/v19.1.0.67
#pdf){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.1.0.67
#pdf){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.1.0.67
#pdf){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.1.0.67
#pdf){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.1.0.67
#pdf){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.1.0.67
#pdf){:target="_blank"}
## Presentation
* [ASP.NET Release Notes](/aspnet/release-notes/v19.1.0.67
#presentation){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.1.0.67
#presentation){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.1.0.67
#presentation){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.1.0.67
#presentation){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.1.0.67
#presentation){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.1.0.67
#presentation){:target="_blank"}
## XlsIO
* [ASP.NET Release Notes](/aspnet/release-notes/v19.1.0.67
#xlsio){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.1.0.67
#xlsio){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.1.0.67
#xlsio){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.1.0.67
#xlsio){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.1.0.67
#xlsio){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.1.0.67
#xlsio){:target="_blank"}

Просмотреть файл

@ -0,0 +1,73 @@
---
title : Essential Studio for File Formats Weekly Nuget Release Release Notes
description : Essential Studio for File Formats Weekly Nuget Release Release Notes
platform : file-formats
documentation: ug
---
# Essential Studio for File Formats Release Notes
{% include release-info.html date="June 15, 2021" version="v19.1.0.69" %}
## DocIO
* [ASP.NET Release Notes](/aspnet/release-notes/v19.1.0.69
#docio){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.1.0.69
#docio){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.1.0.69
#docio){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.1.0.69
#docio){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.1.0.69
#docio){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.1.0.69
#docio){:target="_blank"}
## PDF
* [ASP.NET Release Notes](/aspnet/release-notes/v19.1.0.69
#pdf){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.1.0.69
#pdf){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.1.0.69
#pdf){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.1.0.69
#pdf){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.1.0.69
#pdf){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.1.0.69
#pdf){:target="_blank"}
## Presentation
* [ASP.NET Release Notes](/aspnet/release-notes/v19.1.0.69
#presentation){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.1.0.69
#presentation){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.1.0.69
#presentation){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.1.0.69
#presentation){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.1.0.69
#presentation){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.1.0.69
#presentation){:target="_blank"}
## XlsIO
* [ASP.NET Release Notes](/aspnet/release-notes/v19.1.0.69
#xlsio){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.1.0.69
#xlsio){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.1.0.69
#xlsio){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.1.0.69
#xlsio){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.1.0.69
#xlsio){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.1.0.69
#xlsio){:target="_blank"}

Просмотреть файл

@ -0,0 +1,75 @@
---
title : Essential Studio for File Formats Weekly Nuget Release Release Notes
description : Essential Studio for File Formats Weekly Nuget Release Release Notes
platform : file-formats
documentation: ug
---
# Essential Studio for File Formats Release Notes
{% include release-info.html date="July 13, 2021" version="v19.2.0.47" %}
## DocIO
* [ASP.NET Release Notes](/aspnet/release-notes/v19.2.0.47
#docio){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.2.0.47
#docio){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.2.0.47
#docio){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.2.0.47
#docio){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.2.0.47
#docio){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.2.0.47
#docio){:target="_blank"}
## PDF
* [ASP.NET Release Notes](/aspnet/release-notes/v19.2.0.47
#pdf){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.2.0.47
#pdf){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.2.0.47
#pdf){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.2.0.47
#pdf){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.2.0.47
#pdf){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.2.0.47
#pdf){:target="_blank"}
## Presentation
* [ASP.NET Release Notes](/aspnet/release-notes/v19.2.0.47
#presentation){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.2.0.47
#presentation){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.2.0.47
#presentation){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.2.0.47
#presentation){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.2.0.47
#presentation){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.2.0.47
#presentation){:target="_blank"}
## XlsIO
* [ASP.NET Release Notes](/aspnet/release-notes/v19.2.0.47
#xlsio){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.2.0.47
#xlsio){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.2.0.47
#xlsio){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.2.0.47
#xlsio){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.2.0.47
#xlsio){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.2.0.47
#xlsio){:target="_blank"}

Просмотреть файл

@ -0,0 +1,73 @@
---
title : Essential Studio for File Formats Weekly Nuget Release Release Notes
description : Essential Studio for File Formats Weekly Nuget Release Release Notes
platform : file-formats
documentation: ug
---
# Essential Studio for File Formats Release Notes
{% include release-info.html date="September 07, 2021" version="v19.2.0.60" %}
## DocIO
* [ASP.NET Release Notes](/aspnet/release-notes/v19.2.0.60
#docio){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.2.0.60
#docio){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.2.0.60
#docio){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.2.0.60
#docio){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.2.0.60
#docio){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.2.0.60
#docio){:target="_blank"}
## PDF
* [ASP.NET Release Notes](/aspnet/release-notes/v19.2.0.60
#pdf){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.2.0.60
#pdf){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.2.0.60
#pdf){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.2.0.60
#pdf){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.2.0.60
#pdf){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.2.0.60
#pdf){:target="_blank"}
## Presentation
* [ASP.NET Release Notes](/aspnet/release-notes/v19.2.0.60
#presentation){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.2.0.60
#presentation){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.2.0.60
#presentation){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.2.0.60
#presentation){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.2.0.60
#presentation){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.2.0.60
#presentation){:target="_blank"}
## XlsIO
* [ASP.NET Release Notes](/aspnet/release-notes/v19.2.0.60
#xlsio){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.2.0.60
#xlsio){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.2.0.60
#xlsio){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.2.0.60
#xlsio){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.2.0.60
#xlsio){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.2.0.60
#xlsio){:target="_blank"}

Просмотреть файл

@ -0,0 +1,49 @@
---
title : Essential Studio for File Formats 2021 volume 3 Main Release Notes
description : Essential Studio for File Formats 2021 volume 3 Main Release Notes
platform : file-formats
documentation: ug
---
# Essential Studio for File Formats Release Notes
{% include release-info.html date="September 30, 2021" version="v19.3.0.43" %}
## DocIO
* [ASP.NET Release Notes](/aspnet/release-notes/v19.3.0.43#docio){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.3.0.43#docio){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.3.0.43#docio){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.3.0.43#docio){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.3.0.43#docio){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.3.0.43#docio){:target="_blank"}
## PDF
* [ASP.NET Release Notes](/aspnet/release-notes/v19.3.0.43#pdf){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.3.0.43#pdf){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.3.0.43#pdf){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.3.0.43#pdf){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.3.0.43#pdf){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.3.0.43#pdf){:target="_blank"}
## Presentation
* [ASP.NET Release Notes](/aspnet/release-notes/v19.3.0.43#presentation){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.3.0.43#presentation){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.3.0.43#presentation){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.3.0.43#presentation){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.3.0.43#presentation){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.3.0.43#presentation){:target="_blank"}
## XlsIO
* [ASP.NET Release Notes](/aspnet/release-notes/v19.3.0.43#xlsio){:target="_blank"}
* [ASP.NET MVC Release Notes](/aspnetmvc/release-notes/v19.3.0.43#xlsio){:target="_blank"}
* [ASP.NET Core Release Notes](/aspnet-core/release-notes/v19.3.0.43#xlsio){:target="_blank"}
* [UWP Release Notes](/uwp/release-notes/v19.3.0.43#xlsio){:target="_blank"}
* [Windows Forms Release Notes](/windowsforms/release-notes/v19.3.0.43#xlsio){:target="_blank"}
* [WPF Release Notes](/wpf/release-notes/v19.3.0.43#xlsio){:target="_blank"}

Двоичные данные
File-Formats/XlsIO/WinUI_images/WinUI_images_img1.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 91 KiB

Двоичные данные
File-Formats/XlsIO/WinUI_images/WinUI_images_img2.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 45 KiB

Двоичные данные
File-Formats/XlsIO/WinUI_images/WinUI_images_img3.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 18 KiB

Двоичные данные
File-Formats/XlsIO/WinUI_images/WinUI_images_img4.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 83 KiB

Двоичные данные
File-Formats/XlsIO/WinUI_images/WinUI_images_img5.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 92 KiB

Просмотреть файл

@ -0,0 +1,22 @@
---
title: Does Essential XlsIO provide support for Client Profile | Syncfusion
description: This page tells whether the Syncfusion .NET Excel library (XlsIO) provides support for Client Profile.
platform: File-formats
control: XlsIO
documentation: UG
---
# Does Essential XlsIO provide support for Client Profile?
Yes, Essential XlsIO provides support for Client Profile. In order to use Essential XlsIO in an application (which targeted to Client Profile), the user should include the following assemblies.
* Syncfusion.Compression.Base.dll
* Syncfusion.XlsIO.ClientProfile.dll
## See Also
* [What are the assemblies required for working with XlsIO?](https://help.syncfusion.com/file-formats/xlsio/assemblies-required)
* [What are the NuGet packages required to work with XlsIO?](https://help.syncfusion.com/file-formats/xlsio/nuget-packages-required)
* [What are the supported features by file formats?](https://help.syncfusion.com/file-formats/xlsio/supported-features-by-file-formats)
* [What are the features support platform wise?](https://help.syncfusion.com/file-formats/xlsio/supported-features-by-platforms)
* [How to create an Excel file in C# and VB.NET?](https://help.syncfusion.com/file-formats/xlsio/getting-started-create-excel-file-csharp-vbnet)

Просмотреть файл

@ -0,0 +1,20 @@
---
title: XlsIO support digitally signed Excel files with macros | Syncfusion
description: This page tells whether the Syncfusion XlsIO supports Excel files with macros that are digitally signed.
platform: File-formats
control: XlsIO
documentation: UG
---
# Does XlsIO support Excel files with macros that are digitally signed?
Yes. XlsIO preserves the digital signature from the macro-enabled Excel document. But, it does not have support for remove and modify the signatures.
## See Also
* [Does XlsIO support password protected macro in the Excel documents?](https://help.syncfusion.com/file-formats/xlsio/faqs/does-xlsio-support-password-protected-macro-in-the-excel-documents)
* [How to check whether an Excel document contains macro?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-check-whether-an-excel-document-contains-macro)
* [How to open an Excel 2013 Macro Enabled Template?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-open-an-excel-2013-macro-enabled-template)
* [How to create and open Excel Template files by using XlsIO?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-create-and-open-excel-template-files-by-using-xlsio)
* [How to create a macro?](https://help.syncfusion.com/file-formats/xlsio/working-with-macros#creating-a-macro)
* [How to edit a macro?](https://help.syncfusion.com/file-formats/xlsio/working-with-macros#editing-a-macro)
* [How to remove macros?](https://help.syncfusion.com/file-formats/xlsio/working-with-macros#removing-macros)

Просмотреть файл

@ -0,0 +1,19 @@
---
title: XlsIO support for password protected macro | Syncfusion
description: This page tells whether the Syncfusion XlsIO supports password protected macro in the Excel documents.
platform: File-formats
control: XlsIO
documentation: UG
---
# Does XlsIO support password protected macro in the Excel documents?
Yes. XlsIO preserves the password protection for the macro in the Excel documents for resaving process. But, it does not have support for remove and modify the password.
## See Also
* [Does XlsIO support Excel files with macros that are digitally signed?](faqs/does-xlsio-support-excel-files-with-macros-that-are-digitally-signed)
* [How to check whether an Excel document contains macro?](faqs/how-to-check-whether-an-excel-document-contains-macro)
* [How to open an Excel 2013 Macro Enabled Template?](faqs/how-to-open-an-excel-2013-macro-enabled-template)
* [How to create a macro?](https://help.syncfusion.com/file-formats/xlsio/working-with-macros#creating-a-macro)
* [How to edit a macro?](https://help.syncfusion.com/file-formats/xlsio/working-with-macros#editing-a-macro)
* [How to remove macros?](https://help.syncfusion.com/file-formats/xlsio/working-with-macros#removing-macros)

Просмотреть файл

@ -0,0 +1,164 @@
---
title: Excel file with uninstalled fonts converted to PDF/Image | Syncfusion
description: This page tells what happens when an Excel file containing uninstalled fonts is converted to PDF/Image using XlsIO.
platform: File-formats
control: XlsIO
documentation: UG
---
# How does Excel file with uninstalled fonts is converted to PDF/Image?
When the fonts used in particular Excel document are not installed in the machine, the desired characters will be missing in the PDF/Image conversion. However, XlsIO comes up with a font substitution method through **SubstituteFontEventHandler** event. This will enable user to specify alternate font name to render the characters in the specified alternate font. Otherwise, Microsoft Sans Serif is used as the default one.
N> Due to this font substitution, there might be a slight difference with the rendered text in the generated PDF/Image files during Excel to PDF/Image conversion.
The following code snippet shows how to use font substitution in Excel to PDF conversion using XlsIO.
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
//Initializes the SubstituteFont event to perform font substitution during Excel to PDF conversion
application.SubstituteFont += new SubstituteFontEventHandler(SubstituteFont);
ExcelToPdfConverter converter = new ExcelToPdfConverter(workbook);
PdfDocument pdf = converter.Convert();
Stream stream = File.Create("Output.pdf");
pdf.Save(stream);
}
private static void SubstituteFont(object sender, SubstituteFontEventArgs args)
{
//Sets the alternate font when a specified font is not installed in the production environment
if (args.OriginalFontName == "Wingdings Regular")
args.AlternateFontName = "Bauhaus 93";
else
args.AlternateFontName = "Times New Roman";
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xlsx")
'Initializes the SubstituteFont event to perform font substitution during Excel to PDF conversion
AddHandler application.SubstituteFont, AddressOf SubstituteFont
Dim converter As ExcelToPdfConverter = New ExcelToPdfConverter(workbook)
Dim pdf As PdfDocument = converter.Convert()
Dim stream As Stream = File.Create("Output.pdf")
pdf.Save(stream)
End Using
Private Shared Sub SubstituteFont(ByVal sender As Object, ByVal args As SubstituteFontEventArgs)
'Sets the alternate font when a specified font is not installed in the production environment.
If args.OriginalFontName = "Wingdings Regular" Then
args.AlternateFontName = "Bauhaus 93"
Else
args.AlternateFontName = "Times New Roman"
End If
End Sub
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
FileStream fileStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(fileStream);
//Initializes the SubstituteFont event to perform font substitution during Excel to PDF conversion
application.SubstituteFont += new SubstituteFontEventHandler(SubstituteFont);
XlsIORenderer renderer = new XlsIORenderer();
PdfDocument pdfDocument = renderer.ConvertToPDF(workbook);
FileStream stream = new FileStream("Output.pdf", FileMode.OpenOrCreate, FileAccess.ReadWrite);
pdfDocument.Save(stream);
}
private static void SubstituteFont(object sender, SubstituteFontEventArgs args)
{
//Sets the alternate font when a specified font is not installed in the production environment
if (args.OriginalFontName == "Wingdings Regular")
args.AlternateFontName = "Bauhaus 93";
else
args.AlternateFontName = "Times New Roman";
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
FileStream fileStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(fileStream);
//Initializes the SubstituteFont event to perform font substitution during Excel to PDF conversion
application.SubstituteFont += new SubstituteFontEventHandler(SubstituteFont);
XlsIORenderer renderer = new XlsIORenderer();
PdfDocument pdfDocument = renderer.ConvertToPDF(workbook);
FileStream stream = new FileStream("Output.pdf", FileMode.OpenOrCreate, FileAccess.ReadWrite);
pdfDocument.Save(stream);
}
private static void SubstituteFont(object sender, SubstituteFontEventArgs args)
{
//Sets the alternate font when a specified font is not installed in the production environment
if (args.OriginalFontName == "Wingdings Regular")
args.AlternateFontName = "Bauhaus 93";
else
args.AlternateFontName = "Times New Roman";
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
Stream fileStream = assembly.GetManifestResourceStream("App.Sample.xlsx");
IWorkbook workbook = application.Workbooks.Open(fileStream);
//Initializes the SubstituteFont event to perform font substitution during Excel to PDF conversion
application.SubstituteFont += new SubstituteFontEventHandler(SubstituteFont);
XlsIORenderer renderer = new XlsIORenderer();
PdfDocument pdfDocument = renderer.ConvertToPDF(workbook);
MemoryStream stream = new MemoryStream();
pdfDocument.Save(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("Output.pdf", "application/pdf", stream);
}
private static void SubstituteFont(object sender, SubstituteFontEventArgs args)
{
//Sets the alternate font when a specified font is not installed in the production environment
if (args.OriginalFontName == "Wingdings Regular")
args.AlternateFontName = "Bauhaus 93";
else
args.AlternateFontName = "Times New Roman";
}
{% endhighlight %}
{% endtabs %}
## See Also
* [How to use Substitute Font in Excel-to-PDF Conversion?](https://help.syncfusion.com/file-formats/xlsio/excel-to-pdf-conversion#substitute-font-in-excel-to-pdf-conversion)
* [How to Embed Fonts?](https://help.syncfusion.com/file-formats/xlsio/excel-to-pdf-converter-settings#embed-fonts)
* [How to Capture Warnings in Excel-to-PDF Conversion?](https://help.syncfusion.com/file-formats/xlsio/excel-to-pdf-converter-settings#capture-warnings-in-excel-to-pdf-conversion)
* [What is the image quality when using the ExportQualityImage property?](faqs/what-is-the-image-quality-when-using-the-exportqualityimage-property)
* [How to convert a Worksheet to Image?](https://help.syncfusion.com/file-formats/xlsio/worksheet-to-image-conversion)
* [How to convert a Chart to Image?](https://help.syncfusion.com/file-formats/xlsio/chart-to-image-conversion)

Просмотреть файл

@ -0,0 +1,177 @@
---
title: How to add chart labels to scatter points | XlsIO | Syncfusion
description: This page shows how to add chart labels to scatter points using Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to add chart labels to scatter points?
The following code illustrates adding chart labels to the scatter points of the chart.
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];
//Get the chart from the charts collection
IChart chart = worksheet.Charts[0];
//Get the first series from the Series collection
IChartSerie serieOne = chart.Series[0];
//Set the Series name to the Data Labels through Data Points
serieOne.DataPoints[0].DataLabels.IsSeriesName = true;
//Set the Value to the Data Labels through Data Points
serieOne.DataPoints[0].DataLabels.IsValue = true;
workbook.SaveAs("ChartLabels.xlsx");
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic)
Dim worksheet As IWorksheet = workbook.Worksheets(0)
'Get the chart from the charts collection
Dim chart As IChart = worksheet.Charts(0)
'Get the first series from the Series collection
Dim serieOne As IChartSerie = chart.Series(0)
'Set the Series name to the Data Labels through Data Points
serieOne.DataPoints(0).DataLabels.IsSeriesName = True
'Set the Value to the Data Labels through Data Points
serieOne.DataPoints(0).DataLabels.IsValue = True
workbook.SaveAs("ChartLabels.xlsx")
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
//Instantiates the File Picker
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.SuggestedStartLocation = PickerLocationId.Desktop;
openPicker.FileTypeFilter.Add(".xlsx");
openPicker.FileTypeFilter.Add(".xls");
StorageFile file = await openPicker.PickSingleFileAsync();
//Opens the workbook
IWorkbook workbook = await application.Workbooks.OpenAsync(file, ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];
//Get the chart from the charts collection
IChart chart = worksheet.Charts[0];
//Get the first series from the Series collection
IChartSerie serieOne = chart.Series[0];
//Set the Series name to the Data Labels through Data Points
serieOne.DataPoints[0].DataLabels.IsSeriesName = true;
//Set the Value to the Data Labels through Data Points
serieOne.DataPoints[0].DataLabels.IsValue = true;
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "ChartLabels";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile storageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await workbook.SaveAsAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];
//Get the chart from the charts collection
IChart chart = worksheet.Charts[0];
//Get the first series from the Series collection
IChartSerie serieOne = chart.Series[0];
//Set the Series name to the Data Labels through Data Points
serieOne.DataPoints[0].DataLabels.IsSeriesName = true;
//Set the Value to the Data Labels through Data Points
serieOne.DataPoints[0].DataLabels.IsValue = true;
FileStream stream = new FileStream("ChartLabels.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(stream);
workbook.Close();
excelEngine.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
Stream fileStream = assembly.GetManifestResourceStream("App.Sample.xlsx");
IWorkbook workbook = application.Workbooks.Open(fileStream);
IWorksheet worksheet = workbook.Worksheets[0];
//Get the chart from the charts collection
IChart chart = worksheet.Charts[0];
//Get the first series from the Series collection
IChartSerie serieOne = chart.Series[0];
//Set the Series name to the Data Labels through Data Points
serieOne.DataPoints[0].DataLabels.IsSeriesName = true;
//Set the Value to the Data Labels through Data Points
serieOne.DataPoints[0].DataLabels.IsValue = true;
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("ChartLabels.xlsx", "application/msexcel", stream);
}
{% endhighlight %}
{% endtabs %}
## See Also
* [How to change data point label color of a Waterfall chart?](faqs/how-to-change-data-point-label-color-of-a-waterfall-chart)
* [How to create a Chart with a discontinuous range?](faqs/how-to-create-a-chart-with-a-discontinuous-range)
* [What are the chart data label formatting?](https://help.syncfusion.com/file-formats/xlsio/working-with-charts#data-labels-appearance)
* [What are the font settings for chart legend and data labels?](https://help.syncfusion.com/file-formats/xlsio/working-with-charts#font-settings-for-chart-legend-and-data-labels)

Просмотреть файл

@ -0,0 +1,145 @@
---
title: Avoid exception when adding worksheets with same name | Syncfusion
description: This page helps to avoid exception when adding worksheets with same name in Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to avoid exception when adding worksheets with same name?
Microsoft Excel throws exception when adding worksheet with existing worksheet name in a workbook and XlsIO does the same. But in some case, if you want to add worksheets with the same name using XlsIO then you can avoid the exception in XlsIO by setting IApplication IgnoreSheetNameException property as true.
The following code snippet shows how to add two worksheets with same name in a workbook.
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
//Set IgnoreSheetNameException property as true
application.IgnoreSheetNameException = true;
//Create worksheets with same name
IWorksheet sheet_1 = workbook.Worksheets.Create("Sheet");
IWorksheet sheet_2 = workbook.Worksheets.Create("Sheet");
string fileName = "Output.xlsx";
workbook.SaveAs(fileName);
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
Dim workbook As IWorkbook = application.Workbooks.Create(1)
Set IgnoreSheetNameException property as true
application.IgnoreSheetNameException = true
Create worksheets with same name
Dim sheet_1 As IWorksheet = workbook.Worksheets.Create("Sheet")
Dim sheet_2 As IWorksheet = workbook.Worksheets.Create("Sheet")
Dim fileName As String = "Output.xlsx"
workbook.SaveAs(fileName)
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
//Set IgnoreSheetNameException property as true
application.IgnoreSheetNameException = true;
//Create worksheets with same name
IWorksheet sheet_1 = workbook.Worksheets.Create("Sheet");
IWorksheet sheet_2 = workbook.Worksheets.Create("Sheet");
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "Output";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile storageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await workbook.SaveAsAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
//Set IgnoreSheetNameException property as true
application.IgnoreSheetNameException = true;
//Create worksheets with same name
IWorksheet sheet_1 = workbook.Worksheets.Create("Sheet");
IWorksheet sheet_2 = workbook.Worksheets.Create("Sheet");
//Saving the workbook as stream
FileStream file = new FileStream("Output.xlsx", FileMode.Create, FileAccess.ReadWrite);
workbook.SaveAs(file);
file.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
//Set IgnoreSheetNameException property as true
application.IgnoreSheetNameException = true;
//Create worksheets with same name
IWorksheet sheet_1 = workbook.Worksheets.Create("Sheet");
IWorksheet sheet_2 = workbook.Worksheets.Create("Sheet");
//Saving the workbook as stream
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the document as file and view the saved document
//The operation in SaveAndView under Xamarin varies between Windows Phone, Android and iOS platforms. Please refer xlsio/xamarin section for respective code samples.
if (Device.OS == TargetPlatform.WinPhone || Device.OS == TargetPlatform.Windows)
{
Xamarin.Forms.DependencyService.Get<ISaveWindowsPhone>().SaveAndView(("Output.xlsx", "application/msexcel", stream);
}
else
{
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("Output.xlsx", "application/msexcel", stream);
}
}
{% endhighlight %}
{% endtabs %}
## See Also
* [How to overcome UnauthorizedAccessException?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-overcome-unauthorizedaccessexception)
* [How to overcome StackOverflow exception with IWorksheet Calculate()?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-overcome-stackoverflow-exception-with-iworksheet-calculate())
* [What are the known exceptions of XlsIO?](https://help.syncfusion.com/file-formats/xlsio/known-exceptions)
* [How to create a named range in Excel?](https://help.syncfusion.com/file-formats/xlsio/migrate-from-office-automation-to-syncfusion-xlsio/create-named-range-in-excel)
* [How to use Named Ranges with XlsIO?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-use-named-ranges-with-xlsio)

Просмотреть файл

@ -0,0 +1,161 @@
---
title: How to change data point label color of Waterfall chart | Syncfusion
description: Code example to change data point label color of a Waterfall chart using Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to change data point label color of a Waterfall chart?
The following code snippet shows how to change data point label color of a Waterfall chart.
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2016;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic);
IWorksheet sheet = workbook.Worksheets[0];
//Accessing first chart in the sheet
IChartShape chart = sheet.Charts[0];
//Changing first data point label color
chart.Series[0].DataPoints[0].DataLabels.IsValue = true;
chart.Series[0].DataPoints[0].DataLabels.RGBColor = Color.Green;
workbook.SaveAs("Waterfall.xlsx");
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2016
Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic)
Dim sheet As IWorksheet = workbook.Worksheets(0)
'Create a chart
Dim chart As IChartShape = sheet.Charts(0)
'Changing first data point label color
chart.Series(0).DataPoints(0).DataLabels.IsValue = true
chart.Series(0).DataPoints(0).DataLabels.RGBColor = Color.Green
workbook.SaveAs("Waterfall.xlsx")
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2016;
//Instantiates the File Picker
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.SuggestedStartLocation = PickerLocationId.Desktop;
openPicker.FileTypeFilter.Add(".xlsx");
openPicker.FileTypeFilter.Add(".xls");
StorageFile file = await openPicker.PickSingleFileAsync();
//Opens the workbook
IWorkbook workbook = await application.Workbooks.OpenAsync(file, ExcelOpenType.Automatic);
IWorksheet sheet = workbook.Worksheets[0];
//Accessing first chart in the sheet
IChartShape chart = sheet.Charts[0];
//Changing first data point label color
chart.Series[0].DataPoints[0].DataLabels.IsValue = true;
chart.Series[0].DataPoints[0].DataLabels.RGBColor = Color.Green;
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "Waterfall";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile storageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await workbook.SaveAsAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2016;
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream,ExcelOpenType.Automatic);
IWorksheet sheet = workbook.Worksheets[0];
//Accessing first chart in the sheet
IChartShape chart = sheet.Charts[0];
//Changing first data point label color
chart.Series[0].DataPoints[0].DataLabels.IsValue = true;
chart.Series[0].DataPoints[0].DataLabels.RGBColor = Color.Green;
//Saving the workbook as stream
FileStream stream = new FileStream("Waterfall.xlsx", FileMode.Create, FileAccess.ReadWrite);
workbook.SaveAs(stream);
stream.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2016;
//"App" is the class of Portable project
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
Stream inputStream = assembly.GetManifestResourceStream("SampleBrowser.XlsIO.Samples.Template.Sample.xlsx");
IWorkbook workbook = application.Workbooks.Open(inputStream,ExcelOpenType.Automatic);
IWorksheet sheet = workbook.Worksheets[0];
//Accessing first chart in the sheet
IChartShape chart = sheet.Charts[0];
//Changing first data point label color
chart.Series[0].DataPoints[0].DataLabels.IsValue = true;
chart.Series[0].DataPoints[0].DataLabels.RGBColor = Color.Green;
//Saving the workbook as stream
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the document as file and view the saved document
//The operation in SaveAndView under Xamarin varies between Windows Phone, Android and iOS platforms. Please refer xlsio/xamarin section for respective code samples.
if (Device.OS == TargetPlatform.WinPhone || Device.OS == TargetPlatform.Windows)
{
Xamarin.Forms.DependencyService.Get<ISaveWindowsPhone>().SaveAndView("Waterfall.xlsx", "application/msexcel", stream);
}
else
{
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("Waterfall.xlsx", "application/msexcel", stream);
}
}
{% endhighlight %}
{% endtabs %}
## See Also
* [How to change the grid line color of the Excel sheet?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-change-the-grid-line-color-of-the-excel-sheet)
* [How to import data table with its data type using template markers?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-import-data-table-with-its-data-type-using-template-markers)
* [How to add chart labels to scatter points?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-add-chart-labels-to-scatter-points)
* [How to create a Chart with a discontinuous range?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-create-a-chart-with-a-discontinuous-range)
* [How to create a Waterfall chart?](https://help.syncfusion.com/file-formats/xlsio/working-with-charts#waterfall)
* [What are the chart data label formatting?](https://help.syncfusion.com/file-formats/xlsio/working-with-charts#data-labels-appearance)
* [What are the font settings for chart legend and data labels?](https://help.syncfusion.com/file-formats/xlsio/working-with-charts#font-settings-for-chart-legend-and-data-labels)

Просмотреть файл

@ -0,0 +1,125 @@
---
title: How to change the grid line color of the Excel sheet | Syncfusion
description: Code example to change the grid line color of the Excel sheet using Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to change the grid line color of the Excel sheet?
In Essential XlsIO, you can change the grid line color of the worksheet using **GridLineColor** property. The below code snippet illustrate this.
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//To change the grid line color using ExcelKnownColors
worksheet.GridLineColor = ExcelKnownColors.Blue;
workbook.SaveAs("GridLineColor.xlsx");
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
Dim workbook As IWorkbook = application.Workbooks.Create(1)
Dim worksheet As IWorksheet = workbook.Worksheets(0)
'To change the grid line color using ExcelKnownColors
worksheet.GridLineColor = ExcelKnownColors.Blue
workbook.SaveAs("GridLineColor.xlsx")
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//To change the grid line color using ExcelKnownColors
worksheet.GridLineColor = ExcelKnownColors.Blue;
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "GridLineColor";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile storageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await workbook.SaveAsAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//To change the grid line color using ExcelKnownColors
worksheet.GridLineColor = ExcelKnownColors.Blue;
FileStream stream = new FileStream("GridLineColor.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(stream);
workbook.Close();
excelEngine.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//To change the grid line color using ExcelKnownColors
worksheet.GridLineColor = ExcelKnownColors.Blue;
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("GridLineColor.xlsx", "application/msexcel", stream);
}
{% endhighlight %}
{% endtabs %}
## See Also
* [How to set a line break inside a cell?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-set-a-line-break-inside-a-cell)
* [How to show or hide gridlines?](https://help.syncfusion.com/file-formats/xlsio/working-with-excel-worksheet#show-or-hide-grid-lines)
* [How to hide chart gridlines?](https://help.syncfusion.com/file-formats/xlsio/working-with-charts#hide-chart-gridlines)
* [How to highlight worksheet tabs?](https://help.syncfusion.com/file-formats/xlsio/working-with-excel-worksheet#highlight-worksheet-tabs)
* [How to apply color settings?](https://help.syncfusion.com/file-formats/xlsio/working-with-cell-or-range-formatting#apply-color-settings)
* [How to change data point label color of a Waterfall chart?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-change-data-point-label-color-of-a-waterfall-chart)

Просмотреть файл

@ -0,0 +1,155 @@
---
title: How to check whether an Excel document contains macro | Syncfusion
description: Code example to check whether an Excel document contains macro using Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to check whether an Excel document contains macro?
You can check whether the Excel document contains macro using **IWorkbook.HasMacro** property. The value true indicates that the Excel document has a Vba project.
The following code illustrate how to check whether an Excel document contains macro using XlsIO.
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
// Instantiate the excel application object.
IApplication application = excelEngine.Excel;
// Opening a workbook
IWorkbook workbook = application.Workbooks.Open("Test.xls");
IWorksheet sheet = workbook.Worksheets[0];
//Check macro exist
bool IsMacroEnabled = workbook.HasMacros;
//Save the workbook
workbook.SaveAs("Output.xls");
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
'Instantiate the excel application object.
Dim application As IApplication = excelEngine.Excel
'Opening a Workbook
Dim workbook As IWorkbook = application.Workbooks.Open("Test.xls")
Dim sheet As IWorksheet = workbook.Worksheets(0)
'Check macro exist
Dim IsMacroEnabled As Boolean = workbook.HasMacros
Save the workbook
workbook.SaveAs("Output.xls")
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
//Instantiates the File Picker
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.SuggestedStartLocation = PickerLocationId.Desktop;
openPicker.FileTypeFilter.Add(".xlsm");
openPicker.FileTypeFilter.Add(".xltm");
openPicker.FileTypeFilter.Add(".xls");
StorageFile file = await openPicker.PickSingleFileAsync();
//Opening a workbook with a worksheet
IWorkbook workbook = await application.Workbooks.OpenAsync(file, ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];
//Check macro exist
bool IsMacroEnabled = workbook.HasMacros;
// Save the Workbook
StorageFile storageFile;
if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "Output";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xls" });
storageFile = await savePicker.PickSaveFileAsync();
}
else
{
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
storageFile = await local.CreateFileAsync("Output.xls", CreationCollisionOption.ReplaceExisting);
}
//Saving the workbook
await workbook.SaveAsAsync(storageFile);
// Launch the saved file
await Windows.System.Launcher.LaunchFileAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Instantiate the excel application object.
IApplication application = excelEngine.Excel;
//Opening form module existing workbook
FileStream input = new FileStream(DataPathBase + "Test.xls", FileMode.Open, FileAccess.ReadWrite);
IWorkbook workbook = application.Workbooks.Open(input);
IWorksheet sheet = workbook.Worksheets[0];
//Check macro exist
bool IsMacroEnabled = workbook.HasMacros;
// Save the workbook
FileStream output = new FileStream("Output.xls", FileMode.Create, FileAccess.ReadWrite);
workbook.SaveAs(output);
input.Close();
output.Close();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
//"App" is the class of Portable project
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
Stream inputStream = assembly.GetManifestResourceStream("App.Test.xls");
//Opening the workbook
IWorkbook workbook = application.Workbooks.Open(inputStream);
IWorksheet worksheet = workbook.Worksheets[0];
//Check macro exist
bool IsMacroEnabled = workbook.HasMacros;
//Saving as Excel without macros
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
//Save the stream into XLSX file
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("sample.xls", "application/msexcel", stream);
}
{% endhighlight %}
{% endtabs %}
## See Also
* [How to open an Excel 2013 Macro Enabled Template?](faqs/how-to-open-an-excel-2013-macro-enabled-template)
* [Does XlsIO support Excel files with macros that are digitally signed?](faqs/does-xlsio-support-excel-files-with-macros-that-are-digitally-signed)
* [Does XlsIO support password protected macro in the Excel documents?](faqs/does-xlsio-support-password-protected-macro-in-the-excel-documents)
* [How to create a macro?](https://help.syncfusion.com/file-formats/xlsio/working-with-macros#creating-a-macro)
* [How to edit a macro?](https://help.syncfusion.com/file-formats/xlsio/working-with-macros#editing-a-macro)
* [How to remove macros?](https://help.syncfusion.com/file-formats/xlsio/working-with-macros#removing-macros)

Просмотреть файл

@ -0,0 +1,198 @@
---
title: How to copy a range from one workbook to another | XlsIO | Syncfusion
description: Code example to copy a range from one workbook to another using Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to copy a range from one workbook to another?
You can copy the range from source workbook to the destination workbook through CopyTo method.
The following code snippet illustrates this.
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook sourceWorkbook = application.Workbooks.Open("SourceWorkbook.xlsx", ExcelOpenType.Automatic);
IWorkbook destinationWorkbook = application.Workbooks.Open("DestinationWorkbook.xlsx", ExcelOpenType.Automatic);
//The first worksheet object in the worksheets collection in the Source Workbook is accessed.
IWorksheet sourceWorksheet = sourceWorkbook.Worksheets[0];
//The first worksheet object in the worksheets collection in the Destination Workbook is accessed.
IWorksheet destinationWorksheet = destinationWorkbook.Worksheets[0];
//Assigning an object to the range of cells (90 rows) both for source and destination.
IRange sourceRange = sourceWorksheet.Range[1, 1, 90, 100];
IRange destinationRange = destinationWorksheet.Range[1, 1, 90, 100];
//Copying (90 rows) from Source to Destination worksheet.
sourceRange.CopyTo(destinationRange);
destinationWorkbook.SaveAs("CopyingRange.xlsx");
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
Dim sourceWorkbook As IWorkbook = application.Workbooks.Open("SourceWorkbook.xlsx", ExcelOpenType.Automatic)
Dim destinationWorkbook As IWorkbook = application.Workbooks.Open("DestinationWorkbook.xlsx", ExcelOpenType.Automatic)
'The first worksheet object in the worksheets collection in the Source Workbook is accessed.
Dim sourceWorksheet As Syncfusion.XlsIO.IWorksheet = sourceWorkbook.Worksheets(0)
'The first worksheet object in the worksheets collection in the Destination Workbook is accessed.
Dim destinationWorksheet As Syncfusion.XlsIO.IWorksheet = destinationWorkbook.Worksheets(0)
'Assigning an object to the range of cells (90 rows) both for source and destination.
Dim sourceRange As Syncfusion.XlsIO.IRange = sourceWorksheet.Range(1, 1, 90, 100)
Dim destinationRange As Syncfusion.XlsIO.IRange = destinationWorksheet.Range(1, 1, 90, 100)
'Copying (90 rows) from Source to Destination worksheet.
sourceRange.CopyTo(destinationRange)
destinationWorkbook.SaveAs("CopyingRange.xlsx")
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
//Instantiates the File Picker to open the Source Workbook
FileOpenPicker openPicker1 = new FileOpenPicker();
openPicker1.SuggestedStartLocation = PickerLocationId.Desktop;
openPicker1.FileTypeFilter.Add(".xlsx");
openPicker1.FileTypeFilter.Add(".xls");
StorageFile file1 = await openPicker1.PickSingleFileAsync();
IWorkbook sourceWorkbook = await application.Workbooks.OpenAsync(file1, ExcelOpenType.Automatic);
//Instantiates the File Picker to open the Destination Workbook
FileOpenPicker openPicker2 = new FileOpenPicker();
openPicker2.SuggestedStartLocation = PickerLocationId.Desktop;
openPicker2.FileTypeFilter.Add(".xlsx");
openPicker2.FileTypeFilter.Add(".xls");
StorageFile file2 = await openPicker2.PickSingleFileAsync();
IWorkbook destinationWorkbook = await application.Workbooks.OpenAsync(file2, ExcelOpenType.Automatic);
//The first worksheet object in the worksheets collection in the Source Workbook is accessed.
IWorksheet sourceWorksheet = sourceWorkbook.Worksheets[0];
//The first worksheet object in the worksheets collection in the Destination Workbook is accessed.
IWorksheet destinationWorksheet = destinationWorkbook.Worksheets[0];
//Assigning an object to the range of cells (90 rows) both for source and destination.
IRange sourceRange = sourceWorksheet.Range[1, 1, 90, 100];
IRange destinationRange = destinationWorksheet.Range[1, 1, 90, 100];
//Copying (90 rows) from Source to Destination worksheet.
sourceRange.CopyTo(destinationRange);
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "CopyingRange";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile storageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await destinationWorkbook.SaveAsAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
FileStream inputStream1 = new FileStream("SourceWorkbook.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook sourceWorkbook = application.Workbooks.Open(inputStream1, ExcelOpenType.Automatic);
FileStream inputStream2 = new FileStream("DestinationWorkbook.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook destinationWorkbook = application.Workbooks.Open(inputStream2, ExcelOpenType.Automatic);
//The first worksheet object in the worksheets collection in the Source Workbook is accessed.
IWorksheet sourceWorksheet = sourceWorkbook.Worksheets[0];
//The first worksheet object in the worksheets collection in the Destination Workbook is accessed.
IWorksheet destinationWorksheet = destinationWorkbook.Worksheets[0];
//Assigning an object to the range of cells (90 rows) both for source and destination.
IRange sourceRange = sourceWorksheet.Range[1, 1, 90, 100];
IRange destinationRange = destinationWorksheet.Range[1, 1, 90, 100];
//Copying (90 rows) from Source to Destination worksheet.
sourceRange.CopyTo(destinationRange);
FileStream stream = new FileStream("CopyingRange.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
destinationWorkbook.SaveAs(stream);
destinationWorkbook.Close();
excelEngine.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
Stream inputStream1 = assembly.GetManifestResourceStream("GettingStarted.SourceWorkbook.xlsx");
IWorkbook sourceWorkbook = application.Workbooks.Open(inputStream1);
Stream inputStream2 = assembly.GetManifestResourceStream("GettingStarted.DestinationWorkbook.xlsx");
IWorkbook destinationWorkbook = application.Workbooks.Open(inputStream2);
//The first worksheet object in the worksheets collection in the Source Workbook is accessed.
IWorksheet sourceWorksheet = sourceWorkbook.Worksheets[0];
//The first worksheet object in the worksheets collection in the Destination Workbook is accessed.
IWorksheet destinationWorksheet = destinationWorkbook.Worksheets[0];
//Assigning an object to the range of cells (90 rows) both for source and destination.
IRange sourceRange = sourceWorksheet.Range[1, 1, 90, 100];
IRange destinationRange = destinationWorksheet.Range[1, 1, 90, 100];
//Copying (90 rows) from Source to Destination worksheet.
sourceRange.CopyTo(destinationRange);
MemoryStream stream = new MemoryStream();
destinationWorkbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("CopyingRange.xlsx", "application/msexcel", stream);
}
{% endhighlight %}
{% endtabs %}
## See Also
* [How to copy/paste the cell values that contain only formula?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-copy-paste-the-cell-values-that-contain-only-formula)
* [How to copy or move a range?](https://help.syncfusion.com/file-formats/xlsio/worksheet-cells-manipulation#copy-or-move-a-range)
* [How to copy and paste as link?](https://help.syncfusion.com/file-formats/xlsio/worksheet-cells-manipulation#copy-and-paste-as-link)
* [How to skip blanks while copying?](https://help.syncfusion.com/file-formats/xlsio/worksheet-cells-manipulation#skip-blanks-while-copying)
* [How to open an existing XLSX workbook and save it as XLS?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-open-an-existing-xlsx-workbook-and-save-it-as-xls)

Просмотреть файл

@ -0,0 +1,166 @@
---
title: Copy/paste cell values that contain only formula| XlsIO | Syncfusion
description: Code example to copy and paste the values of the cells that contain only formulas using Essential XlsIO.
platform: File-formats
control: XlsIO
documentation: UG
---
# How to copy/paste the cell values that contain only formula?
You can copy and paste the values of the cell which contain only formula using CopyTo method by specifying the ExcelCopyRangeOptions as None. The following code snippet illustrates this.
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Assigning formula to a cell
worksheet.Range["A3"].Formula="SUM(1+1)";
IRange sourceRange = worksheet.Range["A3"];
IRange destinationRange = worksheet.Range["B1"];
//Copy and paste the values using ExcelCopyRangeOption
sourceRange.CopyTo(destinationRange, ExcelCopyRangeOptions.None);
workbook.SaveAs("Output.xlsx");
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
Dim workbook As IWorkbook = application.Workbooks.Create(1)
Dim worksheet As IWorksheet = workbook.Worksheets(0)
'Assigning formula to a cell
worksheet.Range("A3").Formula = "SUM(1+1)"
Dim sourceRange As IRange = worksheet.Range("A3")
Dim destinationRange As IRange = worksheet.Range("B1")
'Copy and paste the values using ExcelCopyRangeOption
sourceRange.CopyTo(destinationRange, ExcelCopyRangeOptions.None)
workbook.SaveAs("Output.xlsx")
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Assigning formula to a cell
worksheet.Range["A3"].Formula = "SUM(1+1)";
IRange sourceRange = worksheet.Range["A3"];
IRange destinationRange = worksheet.Range["B1"];
//Copy and paste the values using ExcelCopyRangeOption
sourceRange.CopyTo(destinationRange, ExcelCopyRangeOptions.None);
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "Output";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile storageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await workbook.SaveAsAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Assigning formula to a cell
worksheet.Range["A3"].Formula = "SUM(1+1)";
IRange sourceRange = worksheet.Range["A3"];
IRange destinationRange = worksheet.Range["B1"];
//Copy and paste the values using ExcelCopyRangeOption
sourceRange.CopyTo(destinationRange, ExcelCopyRangeOptions.None);
FileStream stream = new FileStream("Output.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(stream);
workbook.Close();
excelEngine.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Assigning formula to a cell
worksheet.Range["A3"].Formula = "SUM(1+1)";
IRange sourceRange = worksheet.Range["A3"];
IRange destinationRange = worksheet.Range["B1"];
//Copy and paste the values using ExcelCopyRangeOption
sourceRange.CopyTo(destinationRange, ExcelCopyRangeOptions.None);
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("Output.xlsx", "application/msexcel", stream);
}
{% endhighlight %}
{% endtabs %}
## See Also
* [How to copy a range from one workbook to another?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-copy-a-range-from-one-workbook-to-another)
* [How to protect certain cells in a worksheet?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-protect-certain-cells-in-a-worksheet)
* [How to set a line break inside a cell?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-set-a-line-break-inside-a-cell)
* [How to format text within a cell?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-format-text-within-a-cell)
* [How to copy or move a range?](https://help.syncfusion.com/file-formats/xlsio/worksheet-cells-manipulation#copy-or-move-a-range)
* [How to copy and paste as link?](https://help.syncfusion.com/file-formats/xlsio/worksheet-cells-manipulation#copy-and-paste-as-link)
* [How to skip blanks while copying?](https://help.syncfusion.com/file-formats/xlsio/worksheet-cells-manipulation#skip-blanks-while-copying)

Просмотреть файл

@ -0,0 +1,622 @@
---
title: How to create a Chart with a discontinuous range | XlsIO | Syncfusion
description: Code example to create a Chart with a discontinuous range using Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to create a Chart with a discontinuous range?
The following code example illustrates creating a chart with discontinuous data ranges.
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Entering the data for the chart.
worksheet.Range["A1"].Text = "Texas books Unit sales";
worksheet.Range["A1:D1"].Merge();
worksheet.Range["A1"].CellStyle.Font.Bold = true;
worksheet.Range["B2"].Text = "Jan";
worksheet.Range["C2"].Text = "Feb";
worksheet.Range["D2"].Text = "Mar";
worksheet.Range["A3"].Text = "Austin";
worksheet.Range["A4"].Text = "Dallas";
worksheet.Range["A5"].Text = "Houston";
worksheet.Range["A6"].Text = "San Antonio";
worksheet.Range["B3"].Number = 53.75;
worksheet.Range["B4"].Number = 52.85;
worksheet.Range["B5"].Number = 59.77;
worksheet.Range["B6"].Number = 96.15;
worksheet.Range["C3"].Number = 79.79;
worksheet.Range["C4"].Number = 59.22;
worksheet.Range["C5"].Number = 10.09;
worksheet.Range["C6"].Number = 73.02;
worksheet.Range["D3"].Number = 26.72;
worksheet.Range["D4"].Number = 33.71;
worksheet.Range["D5"].Number = 45.81;
worksheet.Range["D6"].Number = 12.17;
worksheet.Range["F1"].Number = 26.72;
worksheet.Range["F2"].Number = 33.71;
worksheet.Range["F3"].Number = 45.81;
worksheet.Range["F4"].Number = 12.17;
//Discontinuous range.
IRanges rangesOne = worksheet.CreateRangesCollection();
rangesOne.Add(worksheet.Range["B3:B6"]);
rangesOne.Add(worksheet.Range["F1:F2"]);
IRanges rangesTwo = worksheet.CreateRangesCollection();
rangesTwo.Add(worksheet.Range["D3:D6"]);
rangesTwo.Add(worksheet.Range["F3:F4"]);
//Adding a New (Embedded chart) to the Worksheet.
IChartShape shape = worksheet.Charts.Add();
shape.PrimaryCategoryAxis.Title = "City";
shape.PrimaryValueAxis.Title = "Sales (in Dollars)";
shape.ChartTitle = "Texas Books Unit Sales";
//Setting the Series Names in a Legend.
IChartSerie serieOne = shape.Series.Add();
serieOne.Name = "Jan";
serieOne.Values = rangesOne;
IChartSerie serieTwo = shape.Series.Add();
serieTwo.Name = "March";
serieTwo.Values = rangesTwo;
//Setting the (Rows & Columns) Property for the Embedded chart.
shape.BottomRow = 40;
shape.TopRow = 10;
shape.LeftColumn = 3;
shape.RightColumn = 15;
workbook.SaveAs("DiscontinuousRange.xlsx");
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
Dim workbook As IWorkbook = application.Workbooks.Create(1)
Dim worksheet As IWorksheet = workbook.Worksheets(0)
'Entering the data for the chart.
worksheet.Range("A1").Text = "Texas books Unit sales"
worksheet.Range("A1:D1").Merge()
worksheet.Range("A1").CellStyle.Font.Bold = True
worksheet.Range("B2").Text = "Jan"
worksheet.Range("C2").Text = "Feb"
worksheet.Range("D2").Text = "Mar"
worksheet.Range("A3").Text = "Austin"
worksheet.Range("A4").Text = "Dallas"
worksheet.Range("A5").Text = "Houston"
worksheet.Range("A6").Text = "San Antonio"
worksheet.Range("B3").Number = 53.75
worksheet.Range("B4").Number = 52.85
worksheet.Range("B5").Number = 59.77
worksheet.Range("B6").Number = 96.15
worksheet.Range("C3").Number = 79.79
worksheet.Range("C4").Number = 59.22
worksheet.Range("C5").Number = 10.09
worksheet.Range("C6").Number = 73.02
worksheet.Range("D3").Number = 26.72
worksheet.Range("D4").Number = 33.71
worksheet.Range("D5").Number = 45.81
worksheet.Range("D6").Number = 12.17
worksheet.Range("F1").Number = 26.72
worksheet.Range("F2").Number = 33.71
worksheet.Range("F3").Number = 45.81
worksheet.Range("F4").Number = 12.17
'Discontinuous range.
Dim rangesOne As IRanges = worksheet.CreateRangesCollection()
rangesOne.Add(worksheet.Range("B3:B6"))
rangesOne.Add(worksheet.Range("F1:F2"))
Dim rangesTwo As IRanges = worksheet.CreateRangesCollection()
rangesTwo.Add(worksheet.Range("D3:D6"))
rangesTwo.Add(worksheet.Range("F3:F4"))
'Adding a New (Embedded chart) to the Worksheet.
Dim shape As IChartShape = worksheet.Charts.Add()
shape.PrimaryCategoryAxis.Title = "City"
shape.PrimaryValueAxis.Title = "Sales (in Dollars)"
shape.ChartTitle = "Texas Books Unit Sales"
'Setting the Series Names in a Legend.
Dim serieOne As IChartSerie = shape.Series.Add()
serieOne.Name = "Jan"
serieOne.Values = rangesOne
Dim serieTwo As IChartSerie = shape.Series.Add()
serieTwo.Name = "March"
serieTwo.Values = rangesTwo
'Setting the (Rows & Columns)Property for the Embedded chart.
shape.BottomRow = 40
shape.TopRow = 10
shape.LeftColumn = 3
shape.RightColumn = 15
workbook.SaveAs("DiscontinuousRange.xlsx")
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Entering the data for the chart.
worksheet.Range["A1"].Text = "Texas books Unit sales";
worksheet.Range["A1:D1"].Merge();
worksheet.Range["A1"].CellStyle.Font.Bold = true;
worksheet.Range["B2"].Text = "Jan";
worksheet.Range["C2"].Text = "Feb";
worksheet.Range["D2"].Text = "Mar";
worksheet.Range["A3"].Text = "Austin";
worksheet.Range["A4"].Text = "Dallas";
worksheet.Range["A5"].Text = "Houston";
worksheet.Range["A6"].Text = "San Antonio";
worksheet.Range["B3"].Number = 53.75;
worksheet.Range["B4"].Number = 52.85;
worksheet.Range["B5"].Number = 59.77;
worksheet.Range["B6"].Number = 96.15;
worksheet.Range["C3"].Number = 79.79;
worksheet.Range["C4"].Number = 59.22;
worksheet.Range["C5"].Number = 10.09;
worksheet.Range["C6"].Number = 73.02;
worksheet.Range["D3"].Number = 26.72;
worksheet.Range["D4"].Number = 33.71;
worksheet.Range["D5"].Number = 45.81;
worksheet.Range["D6"].Number = 12.17;
worksheet.Range["F1"].Number = 26.72;
worksheet.Range["F2"].Number = 33.71;
worksheet.Range["F3"].Number = 45.81;
worksheet.Range["F4"].Number = 12.17;
//Discontinuous range.
IRanges rangesOne = worksheet.CreateRangesCollection();
rangesOne.Add(worksheet.Range["B3:B6"]);
rangesOne.Add(worksheet.Range["F1:F2"]);
IRanges rangesTwo = worksheet.CreateRangesCollection();
rangesTwo.Add(worksheet.Range["D3:D6"]);
rangesTwo.Add(worksheet.Range["F3:F4"]);
//Adding a New (Embedded chart) to the Worksheet.
IChartShape shape = worksheet.Charts.Add();
shape.PrimaryCategoryAxis.Title = "City";
shape.PrimaryValueAxis.Title = "Sales (in Dollars)";
shape.ChartTitle = "Texas Books Unit Sales";
//Setting the Series Names in a Legend.
IChartSerie serieOne = shape.Series.Add();
serieOne.Name = "Jan";
serieOne.Values = rangesOne;
IChartSerie serieTwo = shape.Series.Add();
serieTwo.Name = "March";
serieTwo.Values = rangesTwo;
//Setting the (Rows & Columns) Property for the Embedded chart.
shape.BottomRow = 40;
shape.TopRow = 10;
shape.LeftColumn = 3;
shape.RightColumn = 15;
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "DiscontinuousRange";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile storageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await workbook.SaveAsAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Entering the data for the chart.
worksheet.Range["A1"].Text = "Texas books Unit sales";
worksheet.Range["A1:D1"].Merge();
worksheet.Range["A1"].CellStyle.Font.Bold = true;
worksheet.Range["B2"].Text = "Jan";
worksheet.Range["C2"].Text = "Feb";
worksheet.Range["D2"].Text = "Mar";
worksheet.Range["A3"].Text = "Austin";
worksheet.Range["A4"].Text = "Dallas";
worksheet.Range["A5"].Text = "Houston";
worksheet.Range["A6"].Text = "San Antonio";
worksheet.Range["B3"].Number = 53.75;
worksheet.Range["B4"].Number = 52.85;
worksheet.Range["B5"].Number = 59.77;
worksheet.Range["B6"].Number = 96.15;
worksheet.Range["C3"].Number = 79.79;
worksheet.Range["C4"].Number = 59.22;
worksheet.Range["C5"].Number = 10.09;
worksheet.Range["C6"].Number = 73.02;
worksheet.Range["D3"].Number = 26.72;
worksheet.Range["D4"].Number = 33.71;
worksheet.Range["D5"].Number = 45.81;
worksheet.Range["D6"].Number = 12.17;
worksheet.Range["F1"].Number = 26.72;
worksheet.Range["F2"].Number = 33.71;
worksheet.Range["F3"].Number = 45.81;
worksheet.Range["F4"].Number = 12.17;
//Discontinuous range.
IRanges rangesOne = worksheet.CreateRangesCollection();
rangesOne.Add(worksheet.Range["B3:B6"]);
rangesOne.Add(worksheet.Range["F1:F2"]);
IRanges rangesTwo = worksheet.CreateRangesCollection();
rangesTwo.Add(worksheet.Range["D3:D6"]);
rangesTwo.Add(worksheet.Range["F3:F4"]);
//Adding a New (Embedded chart) to the Worksheet.
IChartShape shape = worksheet.Charts.Add();
shape.PrimaryCategoryAxis.Title = "City";
shape.PrimaryValueAxis.Title = "Sales (in Dollars)";
shape.ChartTitle = "Texas Books Unit Sales";
//Setting the Series Names in a Legend.
IChartSerie serieOne = shape.Series.Add();
serieOne.Name = "Jan";
serieOne.Values = rangesOne;
IChartSerie serieTwo = shape.Series.Add();
serieTwo.Name = "March";
serieTwo.Values = rangesTwo;
//Setting the (Rows & Columns) Property for the Embedded chart.
shape.BottomRow = 40;
shape.TopRow = 10;
shape.LeftColumn = 3;
shape.RightColumn = 15;
FileStream stream = new FileStream("DiscontinuousRange.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(stream);
workbook.Close();
excelEngine.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Entering the data for the chart.
worksheet.Range["A1"].Text = "Texas books Unit sales";
worksheet.Range["A1:D1"].Merge();
worksheet.Range["A1"].CellStyle.Font.Bold = true;
worksheet.Range["B2"].Text = "Jan";
worksheet.Range["C2"].Text = "Feb";
worksheet.Range["D2"].Text = "Mar";
worksheet.Range["A3"].Text = "Austin";
worksheet.Range["A4"].Text = "Dallas";
worksheet.Range["A5"].Text = "Houston";
worksheet.Range["A6"].Text = "San Antonio";
worksheet.Range["B3"].Number = 53.75;
worksheet.Range["B4"].Number = 52.85;
worksheet.Range["B5"].Number = 59.77;
worksheet.Range["B6"].Number = 96.15;
worksheet.Range["C3"].Number = 79.79;
worksheet.Range["C4"].Number = 59.22;
worksheet.Range["C5"].Number = 10.09;
worksheet.Range["C6"].Number = 73.02;
worksheet.Range["D3"].Number = 26.72;
worksheet.Range["D4"].Number = 33.71;
worksheet.Range["D5"].Number = 45.81;
worksheet.Range["D6"].Number = 12.17;
worksheet.Range["F1"].Number = 26.72;
worksheet.Range["F2"].Number = 33.71;
worksheet.Range["F3"].Number = 45.81;
worksheet.Range["F4"].Number = 12.17;
//Discontinuous range.
IRanges rangesOne = worksheet.CreateRangesCollection();
rangesOne.Add(worksheet.Range["B3:B6"]);
rangesOne.Add(worksheet.Range["F1:F2"]);
IRanges rangesTwo = worksheet.CreateRangesCollection();
rangesTwo.Add(worksheet.Range["D3:D6"]);
rangesTwo.Add(worksheet.Range["F3:F4"]);
//Adding a New (Embedded chart) to the Worksheet.
IChartShape shape = worksheet.Charts.Add();
shape.PrimaryCategoryAxis.Title = "City";
shape.PrimaryValueAxis.Title = "Sales (in Dollars)";
shape.ChartTitle = "Texas Books Unit Sales";
//Setting the Series Names in a Legend.
IChartSerie serieOne = shape.Series.Add();
serieOne.Name = "Jan";
serieOne.Values = rangesOne;
IChartSerie serieTwo = shape.Series.Add();
serieTwo.Name = "March";
serieTwo.Values = rangesTwo;
//Setting the (Rows & Columns) Property for the Embedded chart.
shape.BottomRow = 40;
shape.TopRow = 10;
shape.LeftColumn = 3;
shape.RightColumn = 15;
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("DiscontinuousRange.xlsx", "application/msexcel", stream);
}
{% endhighlight %}
{% endtabs %}
## See Also
* [How to define discontinuous ranges?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-define-discontinuous-ranges)
* [How to add chart labels to scatter points?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-add-chart-labels-to-scatter-points)
* [How to change data point label color of a Waterfall chart?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-change-data-point-label-color-of-a-waterfall-chart)
* [How to set data range to chart?](https://help.syncfusion.com/file-formats/xlsio/working-with-charts#set-data-range-to-chart)
* [How to access discontinuous ranges?](https://help.syncfusion.com/file-formats/xlsio/worksheet-cells-manipulation#accessing-discontinuous-ranges)
* [How to create a chart?](https://help.syncfusion.com/file-formats/xlsio/working-with-charts#creating-a-chart)
* [How to create a pie chart in Excel?](https://help.syncfusion.com/file-formats/xlsio/migrate-from-office-automation-to-syncfusion-xlsio/create-pie-chart-in-excel)
* [How to create a sparkline from a named range?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-create-a-sparkline-from-a-named-range)

Просмотреть файл

@ -0,0 +1,246 @@
---
title: How to create a sparkline from a named range | XlsIO | Syncfusion
description: This page demonstrates to create a sparkline from a named range using Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to create a sparkline from a named range?
You can create a [sparkline](https://help.syncfusion.com/file-formats/xlsio/working-with-charts#sparkline) from a [named range](https://help.syncfusion.com/file-formats/xlsio/faq#how-to-use-named-ranges-with-xlsio) with the help of the following code.
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2016;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Add sample data
worksheet["A1"].Number = 6911;
worksheet["B1"].Number = 8261;
worksheet["C1"].Number = 812;
worksheet["D1"].Number = 166;
//Add SparklineGroups
ISparklineGroup sparklineGroup = worksheet.SparklineGroups.Add();
//Add SparkLineType
sparklineGroup.SparklineType = SparklineType.Line;
sparklineGroup.MarkersColor = Color.BlueViolet;
//Add sparklines
ISparklines sparklines = sparklineGroup.Add();
//Create named ranges
IName name1 = workbook.Names.Add("Data_Range");
name1.RefersToRange = worksheet.Range["A1:D1"];
IRange dataRange = worksheet.Range["Data_Range"];
IName name2 = workbook.Names.Add("Sparkline_Range");
name2.RefersToRange = worksheet.Range["E1"];
IRange referenceRange = worksheet.Range["Sparkline_Range"];
//Add a sparkline
sparklines.Add(dataRange, referenceRange);
workbook.SaveAs("SparklineFromNamedRange.xlsx");
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2016
Dim workbook As IWorkbook = application.Workbooks.Create(1)
Dim worksheet As IWorksheet = workbook.Worksheets(0)
'Add sample data
worksheet("A1").Number = 6911
worksheet("B1").Number = 8261
worksheet("C1").Number = 812
worksheet("D1").Number = 166
'Add SparklineGroups
Dim sparklineGroup As ISparklineGroup = worksheet.SparklineGroups.Add()
'Add SparkLineType
sparklineGroup.SparklineType = SparklineType.Line
sparklineGroup.MarkersColor = Color.BlueViolet
'Add sparklines
Dim sparklines As ISparklines = sparklineGroup.Add()
'Create named ranges
Dim name1 As IName = workbook.Names.Add("Data_Range")
name1.RefersToRange = worksheet.Range("A1:D1")
Dim dataRange As IRange = worksheet.Range("Data_Range")
Dim name2 As IName = workbook.Names.Add("Sparkline_Range")
name2.RefersToRange = worksheet.Range("E1")
Dim referenceRange As IRange = worksheet.Range("Sparkline_Range")
'Add a sparkline
sparklines.Add(dataRange, referenceRange)
workbook.SaveAs("SparklineFromNamedRange.xlsx")
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2016;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Add sample data
worksheet["A1"].Number = 6911;
worksheet["B1"].Number = 8261;
worksheet["C1"].Number = 812;
worksheet["D1"].Number = 166;
//Add SparklineGroups
ISparklineGroup sparklineGroup = worksheet.SparklineGroups.Add();
//Add SparkLineType
sparklineGroup.SparklineType = SparklineType.Line;
sparklineGroup.MarkersColor = Color.FromArgb(255, 138, 43, 226);
//Add sparklines
ISparklines sparklines = sparklineGroup.Add();
//Create named ranges
IName name1 = workbook.Names.Add("Data_Range");
name1.RefersToRange = worksheet.Range["A1:D1"];
IRange dataRange = worksheet.Range["Data_Range"];
IName name2 = workbook.Names.Add("Sparkline_Range");
name2.RefersToRange = worksheet.Range["E1"];
IRange referenceRange = worksheet.Range["Sparkline_Range"];
//Add a sparkline
sparklines.Add(dataRange, referenceRange);
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "SparklineFromNamedRange";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile storageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await workbook.SaveAsAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2016;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Add sample data
worksheet["A1"].Number = 6911;
worksheet["B1"].Number = 8261;
worksheet["C1"].Number = 812;
worksheet["D1"].Number = 166;
//Add SparklineGroups
ISparklineGroup sparklineGroup = worksheet.SparklineGroups.Add();
//Add SparkLineType
sparklineGroup.SparklineType = SparklineType.Line;
sparklineGroup.MarkersColor = Color.BlueViolet;
//Add sparklines
ISparklines sparklines = sparklineGroup.Add();
//Create named ranges
IName name1 = workbook.Names.Add("Data_Range");
name1.RefersToRange = worksheet.Range["A1:D1"];
IRange dataRange = worksheet.Range["Data_Range"];
IName name2 = workbook.Names.Add("Sparkline_Range");
name2.RefersToRange = worksheet.Range["E1"];
IRange referenceRange = worksheet.Range["Sparkline_Range"];
//Add a sparkline
sparklines.Add(dataRange, referenceRange);
FileStream stream = new FileStream("SparklineFromNamedRange.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(stream);
workbook.Close();
excelEngine.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2016;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Add sample data
worksheet["A1"].Number = 6911;
worksheet["B1"].Number = 8261;
worksheet["C1"].Number = 812;
worksheet["D1"].Number = 166;
//Add SparklineGroups
ISparklineGroup sparklineGroup = worksheet.SparklineGroups.Add();
//Add SparkLineType
sparklineGroup.SparklineType = SparklineType.Line;
sparklineGroup.MarkersColor = Color.BlueViolet;
//Add sparklines
ISparklines sparklines = sparklineGroup.Add();
//Create named ranges
IName name1 = workbook.Names.Add("Data_Range");
name1.RefersToRange = worksheet.Range["A1:D1"];
IRange dataRange = worksheet.Range["Data_Range"];
IName name2 = workbook.Names.Add("Sparkline_Range");
name2.RefersToRange = worksheet.Range["E1"];
IRange referenceRange = worksheet.Range["Sparkline_Range"];
//Add a sparkline
sparklines.Add(dataRange, referenceRange);
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("SparklineFromNamedRange.xlsx", "application/msexcel", stream);
}
{% endhighlight %}
{% endtabs %}
## See Also
* [How to create a Chart with a discontinuous range?](faqs/how-to-create-a-chart-with-a-discontinuous-range)
* [How to create and open Excel Template files by using XlsIO?](faqs/how-to-create-and-open-excel-template-files-by-using-xlsio)
* [How to create sparkline?](https://help.syncfusion.com/file-formats/xlsio/working-with-charts#sparkline)
* [How to create named range in Excel?](https://help.syncfusion.com/file-formats/xlsio/migrate-from-office-automation-to-syncfusion-xlsio/create-named-range-in-excel)
* [How to define names?](https://help.syncfusion.com/file-formats/xlsio/working-with-formulas#defined-names)
* [How to use named ranges in formulas?](https://help.syncfusion.com/file-formats/xlsio/working-with-formulas#named-ranges-in-formulas)

Просмотреть файл

@ -0,0 +1,245 @@
---
title: Create and open Excel Template files by using XlsIO | Syncfusion
description: This page shows how to create and open Excel Template files using Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to create and open Excel Template files by using XlsIO?
**Creating** **Excel** **Template** **Files**
Excel template files (XLT or XLTX) can be created in XlsIO by saving a file as **Template** using **ExcelSaveType** enumeration. The following code snippet illustrates this.
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Save as XLT
workbook.Version = ExcelVersion.Excel97to2003;
workbook.SaveAs("XLTFile.xlt", ExcelSaveType.SaveAsTemplate);
//Save as XLTX
workbook.Version = ExcelVersion.Excel2007;
workbook.SaveAs("XLTXFile.xltx", ExcelSaveType.SaveAsTemplate);
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
Dim workbook As IWorkbook = application.Workbooks.Create(1)
Dim worksheet As IWorksheet = workbook.Worksheets(0)
'Save as XLT
workbook.Version = ExcelVersion.Excel97to2003
workbook.SaveAs("XLTFile.xlt", ExcelSaveType.SaveAsTemplate)
'Save as XLTX
workbook.Version = ExcelVersion.Excel2007
workbook.SaveAs("XLTXFile.xltx", ExcelSaveType.SaveAsTemplate)
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Save as XLT
workbook.Version = ExcelVersion.Excel97to2003;
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "XLTFile";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlt" });
StorageFile storageFile = await savePicker.PickSaveFileAsync();
await workbook.SaveAsAsync(storageFile, ExcelSaveType.SaveAsTemplate);
//Save as XLTX
workbook.Version = ExcelVersion.Excel2007;
FileSavePicker savePicker1 = new FileSavePicker();
savePicker1.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker1.SuggestedFileName = "XLTXFile";
savePicker1.FileTypeChoices.Add("Excel Files", new List<string>() { ".xltx" });
StorageFile storageFile1 = await savePicker1.PickSaveFileAsync();
await workbook.SaveAsAsync(storageFile1, ExcelSaveType.SaveAsTemplate);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Save as XLT
workbook.Version = ExcelVersion.Excel97to2003;
FileStream stream = new FileStream("XLTFile.xlt", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(stream, ExcelSaveType.SaveAsTemplate);
//Save as XLTX
workbook.Version = ExcelVersion.Excel2007;
FileStream stream1 = new FileStream("XLTXFile.xltx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(stream1, ExcelSaveType.SaveAsTemplate);
workbook.Close();
excelEngine.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Save as XLT
workbook.Version = ExcelVersion.Excel97to2003;
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream, ExcelSaveType.SaveAsTemplate);
stream.Position = 0;
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("XLTFile.xlt", "application/vnd.ms-excel", stream);
//Save as XLTX
workbook.Version = ExcelVersion.Excel2007;
MemoryStream stream1 = new MemoryStream();
workbook.SaveAs(stream1, ExcelSaveType.SaveAsTemplate);
stream1.Position = 0;
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("XLTXFile.xltx", "application/vnd.openxmlformats-officedocument.spreadsheetml.template", stream1);
}
{% endhighlight %}
{% endtabs %}
**Opening** **Excel** **Template** **Files**
In XlsIO, an Excel template file is opened in the same way, as excel workbook (.xls and .xlsx) is opened. The following code snippet illustrates this.
{% tabs %}
{% highlight c# %}
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
//Open Excel Template.
IWorkbook workbook = application.Workbooks.Open("Sample.xltx", ExcelOpenType.Automatic);
workbook.SaveAs("Output.xlsx");
workbook.Close();
excelEngine.Dispose();
{% endhighlight %}
{% highlight vb %}
Dim excelEngine As New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
'Open Excel Template.
Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xltx", ExcelOpenType.Automatic)
workbook.SaveAs("Output.xlsx")
workbook.Close()
excelEngine.Dispose()
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
Stream inputStream = new FileStream("Sample.xltx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = await application.Workbooks.OpenAsync(inputStream, ExcelOpenType.Automatic);
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "Output";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile storageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await workbook.SaveAsAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
FileStream inputStream = new FileStream("Sample.xltx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic);
FileStream stream = new FileStream("Output.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(stream);
workbook.Close();
excelEngine.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
Stream fileStream = assembly.GetManifestResourceStream("App.Sample.xltx");
IWorkbook workbook = application.Workbooks.Open(fileStream, ExcelOpenType.Automatic);
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("Output.xlsx", "application/msexcel", stream);
}
{% endhighlight %}
{% endtabs %}
## See Also
* [How to create a Chart with a discontinuous range?](faqs/how-to-create-a-chart-with-a-discontinuous-range)
* [How to create a sparkline from a named range?](faqs/how-to-create-a-sparkline-from-a-named-range)
* [How to open an Excel 2013 Macro Enabled Template?](faqs/how-to-open-an-excel-2013-macro-enabled-template)
* [How to open an Excel file from stream?](faqs/how-to-open-an-excel-file-from-stream)
* [How to open an existing XLSX workbook and save it as XLS?](faqs/how-to-open-an-existing-xlsx-workbook-and-save-it-as-xls)
* [Does XlsIO support Excel files with macros that are digitally signed?](faqs/does-xlsio-support-excel-files-with-macros-that-are-digitally-signed)
* [How to create a simple Excel file?](https://help.syncfusion.com/file-formats/xlsio/getting-started-create-excel-file-csharp-vbnet#create-a-simple-excel-file)
* [How to fill template based data Template Markers](https://help.syncfusion.com/file-formats/xlsio/getting-started-create-excel-file-csharp-vbnet#template-based-data-filling-using-template-markers)
* [How to open an existing workbook?](https://help.syncfusion.com/file-formats/xlsio/loading-and-saving-workbook#opening-an-existing-workbook)
* [How to open a CSV file?](https://help.syncfusion.com/file-formats/xlsio/working-with-excel-worksheet#open-a-csv-file)

Просмотреть файл

@ -0,0 +1,172 @@
---
title: How to define discontinuous ranges | XlsIO | Syncfusion
description: This page explains with an example to define discontinuous ranges using Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to define discontinuous ranges?
You can define a discontinuous range by adding different ranges to the Range collection. The following code example illustrates this.
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Create Range collection.
IRanges rangeCollection = worksheet.CreateRangesCollection();
//Add different ranges to the Range collection.
rangeCollection.Add(worksheet.Range["D2:D3"]);
rangeCollection.Add(worksheet.Range["D10:D11"]);
rangeCollection.Text = "Welcome";
workbook.SaveAs("DiscontinuousRange.xlsx");
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
Dim workbook As IWorkbook = application.Workbooks.Create(1)
Dim worksheet As IWorksheet = workbook.Worksheets(0)
'Create Range collection.
Dim range As IRanges = worksheet.CreateRangesCollection()
'Add different ranges to the Range collection.
range.Add(worksheet.Range("D2:D3"))
range.Add(worksheet.Range("D10:D11"))
range.Text = "Welcome"
workbook.SaveAs("DiscontinuousRange.xlsx")
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Create Range collection.
IRanges rangeCollection = worksheet.CreateRangesCollection();
//Add different ranges to the Range collection.
rangeCollection.Add(worksheet.Range["D2:D3"]);
rangeCollection.Add(worksheet.Range["D10:D11"]);
rangeCollection.Text = "Welcome";
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "DiscontinuousRange";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile storageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await workbook.SaveAsAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Create Range collection.
IRanges rangeCollection = worksheet.CreateRangesCollection();
//Add different ranges to the Range collection.
rangeCollection.Add(worksheet.Range["D2:D3"]);
rangeCollection.Add(worksheet.Range["D10:D11"]);
rangeCollection.Text = "Welcome";
FileStream stream = new FileStream("DiscontinuousRange.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(stream);
workbook.Close();
excelEngine.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Create Range collection.
IRanges rangeCollection = worksheet.CreateRangesCollection();
//Add different ranges to the Range collection.
rangeCollection.Add(worksheet.Range["D2:D3"]);
rangeCollection.Add(worksheet.Range["D10:D11"]);
rangeCollection.Text = "Welcome";
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("DiscontinuousRange.xlsx", "application/msexcel", stream);
}
{% endhighlight %}
{% endtabs %}
## See Also
* [How to create a Chart with a discontinuous range?](faqs/how-to-create-a-chart-with-a-discontinuous-range)
* [How to show or hide a specific range?](https://help.syncfusion.com/file-formats/xlsio/worksheet-rows-and-columns-manipulation#show-or-hide-specific-range)
* [How to access a cell or a range?](https://help.syncfusion.com/file-formats/xlsio/worksheet-cells-manipulation#accessing-a-cell-or-a-range)
* [How to access relative range?](https://help.syncfusion.com/file-formats/xlsio/worksheet-cells-manipulation#accessing-relative-range)
* [How to access discontinuous ranges?](https://help.syncfusion.com/file-formats/xlsio/worksheet-cells-manipulation#accessing-discontinuous-ranges)
* [How to access used range of a worksheet?](https://help.syncfusion.com/file-formats/xlsio/worksheet-cells-manipulation#accessing-used-range-of-a-worksheet)
* [How to copy or move a range?](https://help.syncfusion.com/file-formats/xlsio/worksheet-cells-manipulation#copy-or-move-a-range)

Просмотреть файл

@ -0,0 +1,270 @@
---
title: How to format text within a cell | XlsIO | Syncfusion
description: This page demonstrates how to format text within a cell using Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to format text within a cell?
In Essential XlsIO, You can use the rich text formatting option to format the text within a cell. The following code snippet illustrates this.
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Insert Rich Text.
IRange range = worksheet.Range["A1"];
range.Text = "RichText";
IRichTextString richText = range.RichText;
//Formatting first 4 characters.
IFont redFont = workbook.CreateFont();
redFont.Bold = true;
redFont.Italic = true;
redFont.RGBColor = Color.Red;
richText.SetFont(0, 3, redFont);
//Formatting last 4 characters.
IFont blueFont = workbook.CreateFont();
blueFont.Bold = true;
blueFont.Italic = true;
blueFont.RGBColor = Color.Blue;
richText.SetFont(4, 7, blueFont);
workbook.SaveAs("FormattingText.xlsx");
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
Dim workbook As IWorkbook = application.Workbooks.Create(1)
Dim worksheet As IWorksheet = workbook.Worksheets(0)
'Insert Rich Text.
Dim range As IRange = worksheet.Range("A1")
range.Text = "RichText"
Dim richText As IRichTextString = range.RichText
'Formatting first 4 characters.
Dim redFont As IFont = workbook.CreateFont()
redFont.Bold = True
redFont.Italic = True
redFont.RGBColor = Color.Red
richText.SetFont(0, 3, redFont)
'Formatting last 4 characters.
Dim blueFont As IFont = workbook.CreateFont()
blueFont.Bold = True
blueFont.Italic = True
blueFont.RGBColor = Color.Blue
richText.SetFont(4, 7, blueFont)
workbook.SaveAs("FormattingText.xlsx")
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Insert Rich Text.
IRange range = worksheet.Range["A1"];
range.Text = "RichText";
IRichTextString richText = range.RichText;
//Formatting first 4 characters.
IFont redFont = workbook.CreateFont();
redFont.Bold = true;
redFont.Italic = true;
redFont.RGBColor = Color.FromArgb(255, 255, 0, 0);
richText.SetFont(0, 3, redFont);
//Formatting last 4 characters.
IFont blueFont = workbook.CreateFont();
blueFont.Bold = true;
blueFont.Italic = true;
blueFont.RGBColor = Color.FromArgb(255, 0, 0, 255);
richText.SetFont(4, 7, blueFont);
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "FormattingText";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile storageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await workbook.SaveAsAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Insert Rich Text.
IRange range = worksheet.Range["A1"];
range.Text = "RichText";
IRichTextString richText = range.RichText;
//Formatting first 4 characters.
IFont redFont = workbook.CreateFont();
redFont.Bold = true;
redFont.Italic = true;
redFont.RGBColor = Color.Red;
richText.SetFont(0, 3, redFont);
//Formatting last 4 characters.
IFont blueFont = workbook.CreateFont();
blueFont.Bold = true;
blueFont.Italic = true;
blueFont.RGBColor = Color.Blue;
richText.SetFont(4, 7, blueFont);
FileStream stream = new FileStream("FormattingText.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(stream);
workbook.Close();
excelEngine.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Insert Rich Text.
IRange range = worksheet.Range["A1"];
range.Text = "RichText";
IRichTextString richText = range.RichText;
//Formatting first 4 characters.
IFont redFont = workbook.CreateFont();
redFont.Bold = true;
redFont.Italic = true;
redFont.RGBColor = Color.Red;
richText.SetFont(0, 3, redFont);
//Formatting last 4 characters.
IFont blueFont = workbook.CreateFont();
blueFont.Bold = true;
blueFont.Italic = true;
blueFont.RGBColor = Color.Blue;
richText.SetFont(4, 7, blueFont);
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("FormattingText.xlsx", "application/msexcel", stream);
}
{% endhighlight %}
{% endtabs %}
## See Also
* [How to set a line break inside a cell?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-set-a-line-break-inside-a-cell)
* [How to protect certain cells in a worksheet?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-protect-certain-cells-in-a-worksheet)
* [How to copy/paste the cell values that contain only formula?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-copy-paste-the-cell-values-that-contain-only-formula)
* [How to rich-text formatting?](https://help.syncfusion.com/file-formats/xlsio/working-with-cell-or-range-formatting#rich-text-formatting)
* [How to apply number formats?](https://help.syncfusion.com/file-formats/xlsio/working-with-cell-or-range-formatting#apply-number-formats)
* [How to apply cell text alignment?](https://help.syncfusion.com/file-formats/xlsio/working-with-cell-or-range-formatting#apply-cell-text-alignment)

Просмотреть файл

@ -0,0 +1,146 @@
---
title: Hide the summary rows and columns using XlsIO | Syncfusion
description: This page shows how to hide the summary rows and columns using Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to hide the summary rows and columns using XlsIO?
You can hide the summary rows and columns by using the **IsSummaryRowBelow** and **IsSummaryColumnRight** properties. The following code snippet illustrates this.
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];
//Hide the summary rows at the bottom.
worksheet.PageSetup.IsSummaryRowBelow = false;
//Hide the summary columns to the right.
worksheet.PageSetup.IsSummaryColumnRight = false;
workbook.SaveAs("SuppressRowsColumns.xlsx");
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic)
Dim worksheet As IWorksheet = workbook.Worksheets(0)
'Hide the summary rows at the bottom.
worksheet.PageSetup.IsSummaryRowBelow = False
'Suppress the summary columns to the right.
worksheet.PageSetup.IsSummaryColumnRight = False
workbook.SaveAs("SuppressRowsColumns.xlsx")
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
Stream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = await application.Workbooks.OpenAsync(inputStream, ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];
//Hide the summary rows at the bottom
worksheet.PageSetup.IsSummaryRowBelow = false;
//Hide the summary columns to the right
worksheet.PageSetup.IsSummaryColumnRight = false;
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "SuppressRowsColumns";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile storageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await workbook.SaveAsAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];
//Hide the summary rows at the bottom
worksheet.PageSetup.IsSummaryRowBelow = false;
//Hide the summary columns to the right
worksheet.PageSetup.IsSummaryColumnRight = false;
FileStream stream = new FileStream("SuppressRowsColumns.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(stream);
workbook.Close();
excelEngine.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
Stream fileStream = assembly.GetManifestResourceStream("App.Sample.xlsx");
IWorkbook workbook = application.Workbooks.Open(fileStream);
IWorksheet worksheet = workbook.Worksheets[0];
//Hide the summary rows at the bottom
worksheet.PageSetup.IsSummaryRowBelow = false;
//Hide the summary columns to the right
worksheet.PageSetup.IsSummaryColumnRight = false;
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("SuppressRowsColumns.xlsx", "application/msexcel", stream);
}
{% endhighlight %}
{% endtabs %}
## See Also
* [What is the maximum range of Rows and Columns?](https://help.syncfusion.com/file-formats/xlsio/faqs/what-is-the-maximum-range-of-rows-and-columns)
* [How to unfreeze the rows and columns in XlsIO?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-unfreeze-the-rows-and-columns-in-xlsio)
* [How to sort two or more columns in a pivot table?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-sort-two-or-more-columns-in-a-pivot-table)
* [How to hide Excel worksheets?](https://help.syncfusion.com/file-formats/xlsio/migrate-from-office-automation-to-syncfusion-xlsio/hide-excel-worksheets)
* [How to show or hide rows and columns?](https://help.syncfusion.com/file-formats/xlsio/worksheet-rows-and-columns-manipulation#show-or-hide-rows-and-columns)
* [How to show or hide specific range?](https://help.syncfusion.com/file-formats/xlsio/worksheet-rows-and-columns-manipulation#show-or-hide-specific-range)

Просмотреть файл

@ -0,0 +1,40 @@
---
title: How to ignore print areas set in a worksheet | XlsIO | Syncfusion
description: This page shows how to ignore print areas set in a worksheet using Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to ignore print areas set in a worksheet?
You can set the print area to null or empty to ignore the print areas in a worksheet as below. Setting the **PrintArea** property will impact the process of exporting to PDF. If the print area is set, the export to PDF includes only the print area.
{% tabs %}
{% highlight C# %}
worksheet.PageSetup.PrintArea = string.Empty;
{% endhighlight %}
{% highlight vb %}
worksheet.PageSetup.PrintArea = string.Empty
{% endhighlight %}
{% highlight UWP %}
worksheet.PageSetup.PrintArea = string.Empty;
{% endhighlight %}
{% highlight ASP.NET Core %}
worksheet.PageSetup.PrintArea = string.Empty;
{% endhighlight %}
{% highlight Xamarin %}
worksheet.PageSetup.PrintArea = string.Empty;
{% endhighlight %}
{% endtabs %}
## See Also
* [How to set print titles?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-set-print-titles)
* [How to print Excel document?](https://help.syncfusion.com/file-formats/xlsio/excel-to-pdf-conversion#print-excel-document)
* [What are page setup settings?](https://help.syncfusion.com/file-formats/xlsio/working-with-excel-worksheet#page-setup-settings)
* [How to ignore the green error marker in worksheets?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-ignore-the-green-error-marker-in-worksheets)

Просмотреть файл

@ -0,0 +1,123 @@
---
title: Ignore green error marker in worksheets | XlsIo | Syncfusion
description: This page demonstrates how to ignore the green error marker in worksheets using Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to ignore the green error marker in worksheets?
When there exists data that are of different formats, the error marker appears in cells. In XlsIO You can ignore this by using **IgnoreErrorOptions** property. The following code snippet illustrate this.
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];
//Ignore Error Options
worksheet.Range["B3"].IgnoreErrorOptions = ExcelIgnoreError.All;
workbook.SaveAs("IgnoreGreenError.xlsx");
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic)
Dim worksheet As IWorksheet = workbook.Worksheets(0)
'Ignore Error Options
worksheet.Range("B3").IgnoreErrorOptions = ExcelIgnoreError.All
workbook.SaveAs("IgnoreGreenError.xlsx")
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
Stream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = await application.Workbooks.OpenAsync(inputStream, ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];
//Ignore Error Options
worksheet.Range["B3"].IgnoreErrorOptions = ExcelIgnoreError.All;
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "IgnoreGreenError";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile storageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await workbook.SaveAsAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];
//Ignore Error Options
worksheet.Range["B3"].IgnoreErrorOptions = ExcelIgnoreError.All;
FileStream stream = new FileStream("IgnoreGreenError.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(stream);
workbook.Close();
excelEngine.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
Stream fileStream = assembly.GetManifestResourceStream("App.Sample.xlsx");
IWorkbook workbook = application.Workbooks.Open(fileStream);
IWorksheet worksheet = workbook.Worksheets[0];
//Ignore Error Options
worksheet.Range["B3"].IgnoreErrorOptions = ExcelIgnoreError.All;
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("IgnoreGreenError.xlsx", "application/msexcel", stream);
}
{% endhighlight %}
{% endtabs %}
## See Also
* [How to ignore print areas set in a worksheet?](faqs/how-to-ignore-print-areas-set-in-a-worksheet)
* [How to resolve Excel cannot open the file filename.xlsx... error?](faqs/how-to-resolve-excel-cannot-open-the-file-because-the-file-format-for-the-file-extension-is-not-valid)
* [How to resolve the File does not contain workbook stream error in Syncfusion.XlsIO.Base.dll?](faqs/how-to-resolve-the-file-does-not-contain-workbook-stream-error-in-syncfusion-xlsio-base-dll)

Просмотреть файл

@ -0,0 +1,286 @@
---
title: Import data table with data type using template markers | Syncfusion
description: Code example of Syncfusion .NET Excel library (XlsIO) to import data table with its data type using template markers.
platform: File-formats
control: XlsIO
documentation: UG
---
# How to import data table with its data type using template markers?
You can import data table with its data type using template markers by setting the **VariableTypeAction** to None. The following code snippet illustrates this.
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IWorkbook workbook = excelEngine.Excel.Workbooks.Open("TemplateMarker_Formulas.xlsx");
//Create Template Marker Processor
ITemplateMarkersProcessor marker = workbook.CreateTemplateMarkersProcessor();
//Add marker variable and preserve the text value without detecting the number formats automatically
marker.AddVariable("NumbersTable", GetTable(), VariableTypeAction.None);
//Process the markers in the template and fill the values as it is in the DataTable
marker.ApplyMarkers();
workbook.Version = ExcelVersion.Excel2013;
workbook.SaveAs("TemplateMarkerFormulas.xlsx");
}
//GetTable() method
private static DataTable GetTable()
{
Random r = new Random();
DataTable dt = new DataTable("NumbersTable");
int nCols = 4;
int nRows = 10;
for (int i = 0; i < nCols; i++)
dt.Columns.Add(new DataColumn("Column" + i.ToString()));
for (int i = 0; i < nRows; ++i)
{
DataRow dr = dt.NewRow();
for (int j = 0; j < nCols; j++)
dr[j] = r.Next(0, 10);
dt.Rows.Add(dr);
}
for (int rowIndex = 0; rowIndex < nRows; rowIndex++)
{
dt.Rows[rowIndex]["Column3"] = "2888-" + dt.Rows[rowIndex]["Column3"].ToString();
}
return dt;
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim workbook As IWorkbook = excelEngine.Excel.Workbooks.Open("TemplateMarker_Formulas.xlsx")
'Create Template Marker Processor
Dim marker As ITemplateMarkersProcessor = workbook.CreateTemplateMarkersProcessor()
'Add marker variable and preserve the text value without detecting the number formats automatically
marker.AddVariable("NumbersTable", GetTable(), VariableTypeAction.None)
'Process the markers in the template and fill the values as it is in the DataTable
marker.ApplyMarkers()
workbook.Version = ExcelVersion.Excel2013
workbook.SaveAs("TemplateMarkerFormulas.xlsx")
End Using
'GetTable() method
Private Function GetTable() As DataTable
Dim r As Random = New Random()
Dim dt As DataTable = New DataTable("NumbersTable")
Dim nCols As Integer = 4
Dim nRows As Integer = 10
For i As Integer = 0 To nCols - 1
dt.Columns.Add(New DataColumn("Column" & i.ToString()))
Next
For i As Integer = 0 To nRows - 1
Dim dr As DataRow = dt.NewRow()
For j As Integer = 0 To nCols - 1
dr(j) = r.[Next](0, 10)
Next
dt.Rows.Add(dr)
Next
For rowIndex As Integer = 0 To nRows - 1
dt.Rows(rowIndex)("Column3") = "2888-" & dt.Rows(rowIndex)("Column3").ToString()
Next
Return dt
End Function
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
Stream inputStream = new FileStream("TemplateMarker_Formulas.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = await application.Workbooks.OpenAsync(inputStream, ExcelOpenType.Automatic);
//Create Template Marker Processor
ITemplateMarkersProcessor marker = workbook.CreateTemplateMarkersProcessor();
//Add marker variable and preserve the text value without detecting the number formats automatically
marker.AddVariable("NumbersTable", GetTable(), VariableTypeAction.None);
//Process the markers in the template and fill the values as it is in the DataTable
marker.ApplyMarkers();
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "TemplateMarkerFormulas";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile storageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await workbook.SaveAsAsync(storageFile);
}
//GetTable() method
private static DataTable GetTable()
{
Random r = new Random();
DataTable dt = new DataTable("NumbersTable");
int nCols = 4;
int nRows = 10;
for (int i = 0; i < nCols; i++)
dt.Columns.Add(new DataColumn("Column" + i.ToString()));
for (int i = 0; i < nRows; ++i)
{
DataRow dr = dt.NewRow();
for (int j = 0; j < nCols; j++)
dr[j] = r.Next(0, 10);
dt.Rows.Add(dr);
}
for (int rowIndex = 0; rowIndex < nRows; rowIndex++)
{
dt.Rows[rowIndex]["Column3"] = "2888-" + dt.Rows[rowIndex]["Column3"].ToString();
}
return dt;
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
FileStream inputStream = new FileStream("TemplateMarker_Formulas.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic);
//Create Template Marker Processor
ITemplateMarkersProcessor marker = workbook.CreateTemplateMarkersProcessor();
//Add marker variable and preserve the text value without detecting the number formats automatically
marker.AddVariable("NumbersTable", GetTable(), VariableTypeAction.None);
//Process the markers in the template and fill the values as it is in the DataTable
marker.ApplyMarkers();
FileStream stream = new FileStream("TemplateMarkerFormulas.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(stream);
workbook.Close();
excelEngine.Dispose();
}
//GetTable() method
private static DataTable GetTable()
{
Random r = new Random();
DataTable dt = new DataTable("NumbersTable");
int nCols = 4;
int nRows = 10;
for (int i = 0; i < nCols; i++)
dt.Columns.Add(new DataColumn("Column" + i.ToString()));
for (int i = 0; i < nRows; ++i)
{
DataRow dr = dt.NewRow();
for (int j = 0; j < nCols; j++)
dr[j] = r.Next(0, 10);
dt.Rows.Add(dr);
}
for (int rowIndex = 0; rowIndex < nRows; rowIndex++)
{
dt.Rows[rowIndex]["Column3"] = "2888-" + dt.Rows[rowIndex]["Column3"].ToString();
}
return dt;
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
Stream fileStream = assembly.GetManifestResourceStream("App.TemplateMarker_Formulas.xlsx");
IWorkbook workbook = application.Workbooks.Open(fileStream);
//Create Template Marker Processor
ITemplateMarkersProcessor marker = workbook.CreateTemplateMarkersProcessor();
//Add marker variable and preserve the text value without detecting the number formats automatically
marker.AddVariable("NumbersTable", GetTable(), VariableTypeAction.None);
//Process the markers in the template and fill the values as it is in the DataTable
marker.ApplyMarkers();
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("TemplateMarkerFormulas.xlsx", "application/msexcel", stream);
}
//GetTable() method
private static DataTable GetTable()
{
Random r = new Random();
DataTable dt = new DataTable("NumbersTable");
int nCols = 4;
int nRows = 10;
for (int i = 0; i < nCols; i++)
dt.Columns.Add(new DataColumn("Column" + i.ToString()));
for (int i = 0; i < nRows; ++i)
{
DataRow dr = dt.NewRow();
for (int j = 0; j < nCols; j++)
dr[j] = r.Next(0, 10);
dt.Rows.Add(dr);
}
for (int rowIndex = 0; rowIndex < nRows; rowIndex++)
{
dt.Rows[rowIndex]["Column3"] = "2888-" + dt.Rows[rowIndex]["Column3"].ToString();
}
return dt;
}
{% endhighlight %}
{% endtabs %}
## See Also
* [How to import data from DataTable?](https://help.syncfusion.com/file-formats/xlsio/working-with-data#import-data-from-datatable)
* [How to import data from DataColumn?](https://help.syncfusion.com/file-formats/xlsio/working-with-data#import-data-from-datacolumn)
* [How to import data from DataView?](https://help.syncfusion.com/file-formats/xlsio/working-with-data#import-data-from-dataview)
* [How to export data from worksheet to DataTable?](https://help.syncfusion.com/file-formats/xlsio/working-with-data#import-data-from-datatable)
* [What are Import Data Options?](https://help.syncfusion.com/file-formats/xlsio/working-with-data#import-data-options)
* [How to bind from DataTable?](https://help.syncfusion.com/file-formats/xlsio/working-with-template-markers#bind-from-datatable)
* [How to bind from Nested Collection Objects with import data and group options?](https://help.syncfusion.com/file-formats/xlsio/working-with-template-markers#bind-from-nested-collection-objects-with-import-data-and-group-options)
* [How to use Template marker with conditional formatting?](https://help.syncfusion.com/file-formats/xlsio/working-with-template-markers#template-marker-with-conditional-formatting)

Просмотреть файл

@ -0,0 +1,218 @@
---
title: Merge Excel files from multiple workbooks into single file |Syncfusion
description: Code example to merge several Excel files from more than one workbook to a single file using Suncfusion's XlsIO.
platform: File-formats
control: XlsIO
documentation: UG
---
# How to merge Excel files from more than one workbook to a single file?
You can merge several Excel files from more than one workbook to a single file. The following code snippet illustrates this.
{% tabs %}
{% highlight c# %}
//Loads all the template documents from Data folder
string[] files = Directory.GetFiles(@"../../Data/");
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
//Create empty Excel workbook instance with one empty worksheet
IWorkbook workbook = application.Workbooks.Create(1);
//Enumerates all the workbook files from the data folder and clone and merge it into new workbook
foreach (string file in files)
{
//Loads the all template document from data folder
FileStream inputStream = new FileStream(file, FileMode.Open, FileAccess.Read);
//Opens the template workbook from stream
IWorkbook tempWorkbook = application.Workbooks.Open(inputStream);
//Disposes the stream
inputStream.Dispose();
//Cloning all workbook's worksheets
workbook.Worksheets.AddCopy(tempWorkbook.Worksheets);
}
//Removing the first empty worksheet
workbook.Worksheets.Remove(0);
workbook.SaveAs("MergingFiles.xlsx");
}
{% endhighlight %}
{% highlight vb %}
'Loads the all template document from data folder
Dim files As String() = Directory.GetFiles("../../Data/")
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
'Create empty Excel workbook instance with one empty worksheet
Dim workbook As IWorkbook = application.Workbooks.Create(1)
'Enumerates all the workbook files from the data folder and clone and merge it into new workbook
For Each file As String In files
'Loads the all template document from data folder
Dim inputStream As New FileStream(file, FileMode.Open, FileAccess.Read)
'Opens the template workbook from stream
Dim tempWorkbook As IWorkbook = application.Workbooks.Open(inputStream)
'Disposes the stream
inputStream.Dispose()
'Cloning all workbook's worksheets
workbook.Worksheets.AddCopy(tempWorkbook.Worksheets)
Next
'Removing the first empty worksheet
workbook.Worksheets.Remove(0)
workbook.SaveAs("MergingFiles.xlsx")
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
//Create empty Excel workbook instance with one empty worksheet
IWorkbook workbook = application.Workbooks.Create(1);
//Instantiates the File Picker
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.SuggestedStartLocation = PickerLocationId.Desktop;
openPicker.FileTypeFilter.Add(".xlsx");
openPicker.FileTypeFilter.Add(".xls");
IReadOnlyList<StorageFile> files = await openPicker.PickMultipleFilesAsync();
//Enumerates all the workbook files from the data folder and clone and merge it into new workbook
foreach (StorageFile file in files)
{
//Opens the template workbook from stream
IWorkbook tempWorkbook = await application.Workbooks.OpenAsync(file);
//Cloning all workbook's worksheets
workbook.Worksheets.AddCopy(tempWorkbook.Worksheets);
}
//Removing the first empty worksheet
workbook.Worksheets.Remove(0);
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "MergingFiles";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile storageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await workbook.SaveAsAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
//Loads all the template documents from Data folder
string[] files = Directory.GetFiles(@"Data/");
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
//Create empty Excel workbook instance with one empty worksheet
IWorkbook workbook = application.Workbooks.Create(1);
//Enumerates all the workbook files from the data folder and clone and merge it into new workbook
foreach (string file in files)
{
//Loads a template document from data folder
FileStream inputStream = new FileStream(file, FileMode.Open, FileAccess.Read);
//Opens the template workbook from stream
IWorkbook tempWorkbook = application.Workbooks.Open(inputStream);
//Disposes the stream
inputStream.Dispose();
//Cloning all workbook's worksheets
workbook.Worksheets.AddCopy(tempWorkbook.Worksheets);
}
//Removing the first empty worksheet
workbook.Worksheets.Remove(0);
FileStream outputStream = new FileStream("MergingFiles.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(outputStream);
workbook.Close();
excelEngine.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
//Get the path with files to merge
string path = Path.Combine(Environment.CurrentDirectory);
string[] files = Directory.GetFiles(path, "Sample*");
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
//Create empty Excel workbook instance with one empty worksheet
IWorkbook workbook = application.Workbooks.Create(1);
//Enumerates all the workbook files from the folder and clone and merge it into new workbook
foreach (string file in files)
{
//Loads a template document from the folder
FileStream inputStream = new FileStream(file, FileMode.Open, FileAccess.Read);
//Opens the template workbook from stream
IWorkbook tempWorkbook = application.Workbooks.Open(inputStream);
//Disposes the stream
inputStream.Dispose();
//Cloning all workbook's worksheets
workbook.Worksheets.AddCopy(tempWorkbook.Worksheets);
}
//Removing the first empty worksheet
workbook.Worksheets.Remove(0);
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("MergingFiles.xlsx", "application/msexcel", stream);
}
{% endhighlight %}
{% endtabs %}
## See Also
* [How to open an existing XLSX workbook and save it as XLS?](faqs/how-to-open-an-existing-xlsx-workbook-and-save-it-as-xls)
* [How to create and open Excel Template files by using XlsIO?](faqs/how-to-create-and-open-excel-template-files-by-using-xlsio)
* [How to copy a range from one workbook to another?](faqs/how-to-copy-a-range-from-one-workbook-to-another)
* [Does XlsIO support Excel files with macros that are digitally signed?](faqs/does-xlsio-support-excel-files-with-macros-that-are-digitally-signed)
* [How does Excel file with uninstalled fonts is converted to PDF/Image?](faqs/how-does-excel-file-with-uninstalled-fonts-is-converted-to-pdf-image)
* [How to sort two or more columns in a pivot table?](faqs/how-to-sort-two-or-more-columns-in-a-pivot-table)
* [How to move or copy a worksheet?](https://help.syncfusion.com/file-formats/xlsio/working-with-excel-worksheet#move-or-copy-a-worksheet)

Просмотреть файл

@ -0,0 +1,109 @@
---
title: How to open an Excel 2013 Macro Enabled Template | XlsIO | Syncfusion
description: Code example to open an Excel 2013 Macro Enabled Template using Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to open an Excel 2013 Macro Enabled Template?
You can open and save an Excel 2013 Macro Enabled Template to XLSM (Excel 2013 Macro Enabled Document) format. The following code snippet illustrates this.
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
//Open an existing XLTM file
IWorkbook workbook = application.Workbooks.Open("Sample.xltm", ExcelOpenType.Automatic);
//Save the file as XLSM
workbook.SaveAs("Output.xlsm");
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
'Open an existing XLTM file
Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xltm", ExcelOpenType.Automatic)
'Save the file as XLSM
workbook.SaveAs("Output.xlsm")
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
//Open an existing XLTM file
Stream inputStream = new FileStream("Sample.xltm", FileMode.Open, FileAccess.Read);
IWorkbook workbook = await application.Workbooks.OpenAsync(inputStream, ExcelOpenType.Automatic);
//Save the file as XLSM
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "Output";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsm" });
StorageFile storageFile = await savePicker.PickSaveFileAsync();
await workbook.SaveAsAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
//Open an existing XLTM file
FileStream inputStream = new FileStream("Sample.xltm", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic);
//Save the file as XLSM
FileStream outputStream = new FileStream("Output.xlsm", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(outputStream);
workbook.Close();
excelEngine.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
//Open an existing XLTM file
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
Stream fileStream = assembly.GetManifestResourceStream("App.Sample.xltm");
IWorkbook workbook = application.Workbooks.Open(fileStream);
//Save the file as XLSM
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("Output.xlsm", "application/vnd.ms-excel.sheet.macroEnabled.12", stream);
}
{% endhighlight %}
{% endtabs %}
## See Also
* [How to check whether an Excel document contains macro?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-check-whether-an-excel-document-contains-macro)
* [Does XlsIO support Excel files with macros that are digitally signed?](https://help.syncfusion.com/file-formats/xlsio/faqs/does-xlsio-support-excel-files-with-macros-that-are-digitally-signed)
* [Does XlsIO support password protected macro in the Excel documents?](https://help.syncfusion.com/file-formats/xlsio/faqs/does-xlsio-support-password-protected-macro-in-the-excel-documents)
* [How to create a macro?](https://help.syncfusion.com/file-formats/xlsio/working-with-macros#creating-a-macro)
* [How to edit a macro?](https://help.syncfusion.com/file-formats/xlsio/working-with-macros#editing-a-macro)
* [How to remove macros?](https://help.syncfusion.com/file-formats/xlsio/working-with-macros#removing-macros)

Просмотреть файл

@ -0,0 +1,41 @@
---
title: Open an Excel document that is already open in MS-Excel | Syncfusion
description: This page tells how to open an Excel document that is already open in Microsoft Excel in Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to open an Excel document that is already open in MS-Excel?
Syncfusion XlsIO do support opening an Excel document that is already open in Microsoft Excel. But the approaches are different in .NET Framework and .NET Standard.
OpenReadOnly method can be used in .NET Framework whereas FileShare.ReadWrite overload should be used while loading the file into file stream in .NET Standard. The following code snippet explains this.
{% tabs %}
{% highlight C# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2016;
IWorkbook workbook = application.Workbooks.OpenReadOnly("Template.xlsx");
workbook.SaveAs("Output.xlsx");
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2016;
FileStream inputStream = new FileStream("Template.xlsx", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
IWorkbook workbook = application.Workbooks.Open(inputStream);
FileStream outputStream = new FileStream("Output.xlsx", FileMode.Create, FileAccess.ReadWrite);
workbook.SaveAs(outputStream);
}
{% endhighlight %}
{% endtabs %}

Просмотреть файл

@ -0,0 +1,120 @@
---
title: How to open an Excel file from stream | XlsIO | Syncfusion
description: This page demonstrates with an example to open an Excel file from stream using Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to open an Excel file from stream?
XlsIO provides support for opening a file that is stored as a stream. The following code snippet illustrates this.
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
//Opening a File from a Stream
FileStream fileStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
IWorkbook workbook = application.Workbooks.Open(fileStream);
workbook.SaveAs("Output.xlsx");
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
'Opening a File from a Stream
Dim fileStream As New FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
Dim workbook As IWorkbook = application.Workbooks.Open(fileStream)
workbook.SaveAs("Output.xlsx")
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
//Opening a File from a Stream
Stream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = await application.Workbooks.OpenAsync(inputStream, ExcelOpenType.Automatic);
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "Output";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile storageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await workbook.SaveAsAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
//Opening a File from a Stream
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic);
FileStream stream = new FileStream("Output.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(stream);
workbook.Close();
excelEngine.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
//Opening a File from a Stream
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
Stream fileStream = assembly.GetManifestResourceStream("App.Sample.xlsx");
IWorkbook workbook = application.Workbooks.Open(fileStream);
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("Output.xlsx", "application/msexcel", stream);
}
{% endhighlight %}
{% endtabs %}
## See Also
* [How to open an Excel 2013 Macro Enabled Template?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-open-an-excel-2013-macro-enabled-template)
* [How to create and open Excel Template files by using XlsIO?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-create-and-open-excel-template-files-by-using-xlsio)
* [How to open an existing workbook from stream?](https://help.syncfusion.com/file-formats/xlsio/loading-and-saving-workbook#opening-an-existing-workbook-from-stream)
* [How to open a CSV file?](https://help.syncfusion.com/file-formats/xlsio/working-with-excel-worksheet#open-a-csv-file)
* [How to open an existing XLSX workbook and save it as XLS?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-open-an-existing-xlsx-workbook-and-save-it-as-xls)
* [How to resolve the File does not contain workbook stream error in Syncfusion.XlsIO.Base.dll?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-resolve-the-file-does-not-contain-workbook-stream-error)
* [How to resolve Excel cannot open the file filename.xlsx... error?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-resolve-excel-cannot-open-the-file-because-the-file-format-for-the-file-extension-is-not-valid)
* [How to save a file to stream?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-save-a-file-to-stream)
* [How to merge excel files from more than one workbook to a single file?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-merge-excel-files-from-more-than-one-workbook-to-a-single-file)
* [Does XlsIO support Excel files with macros that are digitally signed?](https://help.syncfusion.com/file-formats/xlsio/faqs/does-xlsio-support-excel-files-with-macros-that-are-digitally-signed)
* [How does Excel file with uninstalled fonts is converted to PDF/Image?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-does-excel-file-with-uninstalled-fonts-is-converted-to-pdf-image)

Просмотреть файл

@ -0,0 +1,116 @@
---
title: How to open an existing XLSX workbook and save it as XLS | Syncfusion
description: Code example to open an existing XLSX workbook and save it as XLS using Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to open an existing XLSX workbook and save it as XLS?
You can open and save an existing .xlsx file to the .xls file by using XlsIO. The following code snippet illustrates this.
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
//Open an existing Excel 2013 file
IWorkbook workbook = excelEngine.Excel.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic);
//Save it as "Excel 97 to 2003" format
workbook.Version = ExcelVersion.Excel97to2003;
workbook.SaveAs("Output.xls");
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
'Open an existing Excel 2013 file
Dim workbook As IWorkbook = excelEngine.Excel.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic)
'Save it as "Excel 97 to 2003" format
workbook.Version = ExcelVersion.Excel97to2003
workbook.SaveAs("Output.xls")
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
//Open an existing Excel 2013 file
Stream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = await application.Workbooks.OpenAsync(inputStream, ExcelOpenType.Automatic);
//Save it as "Excel 97 to 2003" format
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "Output";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xls" });
StorageFile storageFile = await savePicker.PickSaveFileAsync();
await workbook.SaveAsAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
//Open an existing Excel 2013 file
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic);
//Save it as "Excel 97 to 2003" format
FileStream outputStream = new FileStream("Output.xls", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(outputStream);
workbook.Close();
excelEngine.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
//Open an existing Excel 2013 file
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
Stream fileStream = assembly.GetManifestResourceStream("App.Sample.xlsx");
IWorkbook workbook = application.Workbooks.Open(fileStream);
//Save it as "Excel 97 to 2003" format
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("Output.xls", "application/vnd.ms-excel", stream);
}
{% endhighlight %}
{% endtabs %}
N> Workbook must be saved in appropriate version, failing in this leads to file corruption.
## See Also
* [How to open an Excel file from stream?](faqs/how-to-open-an-excel-file-from-stream)
* [How to open an Excel 2013 Macro Enabled Template?](faqs/how-to-open-an-excel-2013-macro-enabled-template)
* [How to create and open Excel Template files by using XlsIO?](faqs/how-to-create-and-open-excel-template-files-by-using-xlsio)
* [How to save a file to stream?](faqs/how-to-save-a-file-to-stream)
* [How to merge excel files from more than one workbook to a single file?](faqs/how-to-merge-excel-files-from-more-than-one-workbook-to-a-single-file)
* [How to opening an existing workbook?](https://help.syncfusion.com/file-formats/xlsio/loading-and-saving-workbook#opening-an-existing-workbook)
* [How to save an Excel workbook to file system?](https://help.syncfusion.com/file-formats/xlsio/loading-and-saving-workbook#saving-a-excel-workbook-to-file-system)

Просмотреть файл

@ -0,0 +1,63 @@
---
title: Avoid StackOverflow exception with IWorksheet Calculate() |Syncfusion
description: This page shows how to overcome StackOverflow exception while calling Calculate method of IWorksheet using XlsIO.
platform: File-formats
control: XlsIO
documentation: UG
---
# How to overcome StackOverflow exception with IWorksheet's Calculate()?
StackOverflow exception occurs when the number of <i>IterationMaxCount</i>, <i>MaximumRecursiveCalls</i> and <i>MaxStackDepth</i> exceeds in the `CalcEngine`. To avoid this StackOverflow exception while computing the formulas iteratively exceeding the maximum capacity, you need to set the values for these properties before calling the <b>Calculate</b> method of <b>IWorksheet</b> interface.
The following code snippet explains this.
{% tabs %}
{% highlight C# %}
worksheet.EnableSheetCalculations();
worksheet.CalcEngine.UseFormulaValues = true;
worksheet.CalcEngine.MaximumRecursiveCalls = 10000;
worksheet.CalcEngine.IterationMaxCount = 10000;
CalcEngine.MaxStackDepth = 10000;
{% endhighlight %}
{% highlight vb %}
worksheet.EnableSheetCalculations()
worksheet.CalcEngine.UseFormulaValues = True
worksheet.CalcEngine.MaximumRecursiveCalls = 10000
worksheet.CalcEngine.IterationMaxCount = 10000
CalcEngine.MaxStackDepth = 10000
{% endhighlight %}
{% highlight UWP %}
worksheet.EnableSheetCalculations();
worksheet.CalcEngine.UseFormulaValues = true;
worksheet.CalcEngine.MaximumRecursiveCalls = 10000;
worksheet.CalcEngine.IterationMaxCount = 10000;
CalcEngine.MaxStackDepth = 10000;
{% endhighlight %}
{% highlight ASP.NET Core %}
worksheet.EnableSheetCalculations();
worksheet.CalcEngine.UseFormulaValues = true;
worksheet.CalcEngine.MaximumRecursiveCalls = 10000;
worksheet.CalcEngine.IterationMaxCount = 10000;
CalcEngine.MaxStackDepth = 10000;
{% endhighlight %}
{% highlight Xamarin %}
worksheet.EnableSheetCalculations();
worksheet.CalcEngine.UseFormulaValues = true;
worksheet.CalcEngine.MaximumRecursiveCalls = 10000;
worksheet.CalcEngine.IterationMaxCount = 10000;
CalcEngine.MaxStackDepth = 10000;
{% endhighlight %}
{% endtabs %}
## See Also
* [How to overcome UnauthorizedAccessException?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-overcome-unauthorizedaccessexception)
* [How to avoid exception when adding worksheets with same name?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-avoid-exception-when-adding-worksheets-with-same-name)
* [What are the known exceptions of XlsIO?](https://help.syncfusion.com/file-formats/xlsio/known-exceptions)
* [What is Calculation Engine?](https://help.syncfusion.com/file-formats/xlsio/working-with-formulas#calculation-engine)
* [What are Calculate Options?](https://help.syncfusion.com/file-formats/xlsio/working-with-formulas#calculate-options)

Просмотреть файл

@ -0,0 +1,20 @@
---
title: How to overcome UnauthorizedAccessException | XlsIO | Syncfusion
description: This page shows how to overcome UnauthorizedAccessException using Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to overcome UnauthorizedAccessException?
The [UnauthorizedAccessException](https://docs.microsoft.com/en-us/dotnet/api/system.unauthorizedaccessexception?view=netcore-3.1) occurs when you are trying to write in a read-only/hidden file or if you dont have access to the particular folder that contains the file or the folder might be locked currently.
First, check whether you can access the folder and the file directly. Then, right-click the input file and check whether the Read-only/Hidden checkbox is checked. If it is checked, kindly uncheck the Read-only/Hidden checkbox and try running the project as an administrator or an authorized user to access the file folder.
## See Also
* [How to overcome StackOverflow exception with IWorksheet Calculate()?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-overcome-stackoverflow-exception-with-iworksheet-calculate())
* [How to avoid exception when adding worksheets with same name?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-avoid-exception-when-adding-worksheets-with-same-name)
* [What are the known exceptions of XlsIO?](https://help.syncfusion.com/file-formats/xlsio/known-exceptions)
* [How to secure Excel documents?](https://help.syncfusion.com/file-formats/xlsio/security)

Просмотреть файл

@ -0,0 +1,166 @@
---
title: How to protect certain cells in a worksheet | XlsIO | Syncfusion
description: This page demonstrates with an example to protect certain cells in a worksheet using Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to protect certain cells in a worksheet?
All the cells in an Excel worksheet have a Locked property, which determines if the cell will be editable. When a worksheet is protected, all the cells in the worksheet get locked, by default.
However, there is often a need to protect only certain cells in a worksheet. In this scenario, you need to protect a worksheet, and set the **IsLocked** property as false for the cells that need to be made editable.
The following code snippet illustrate this.
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];
//Sample data
worksheet.Range["A1:K20"].Text = "Locked";
//A1:A10 will not be protected, hence it is editable.
worksheet.Range["A1:A10"].CellStyle.Locked = false;
worksheet.Range["A1:A10"].Text = "UnLocked";
worksheet.Protect("syncfusion", ExcelSheetProtection.All);
workbook.SaveAs("ProtectCells.xlsx");
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic)
Dim worksheet As IWorksheet = workbook.Worksheets(0)
'Sample data
worksheet.Range("A1:K20").Text = "Locked"
'A1:A10 will not be protected.
worksheet.Range("A1:A10").CellStyle.Locked = False
worksheet.Range("A1:A10").Text = "UnLocked"
worksheet.Protect("syncfusion", ExcelSheetProtection.All)
workbook.SaveAs("ProtectCells.xlsx")
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
Stream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = await application.Workbooks.OpenAsync(inputStream, ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];
//Sample data
worksheet.Range["A1:K20"].Text = "Locked";
//A1:A10 will not be protected, hence it is editable.
worksheet.Range["A1:A10"].CellStyle.Locked = false;
worksheet.Range["A1:A10"].Text = "UnLocked";
worksheet.Protect("syncfusion", ExcelSheetProtection.All);
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "ProtectCells";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile storageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await workbook.SaveAsAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];
//Sample data
worksheet.Range["A1:K20"].Text = "Locked";
//A1:A10 will not be protected, hence it is editable.
worksheet.Range["A1:A10"].CellStyle.Locked = false;
worksheet.Range["A1:A10"].Text = "UnLocked";
worksheet.Protect("syncfusion", ExcelSheetProtection.All);
FileStream stream = new FileStream("ProtectCells.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(stream);
workbook.Close();
excelEngine.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
Stream fileStream = assembly.GetManifestResourceStream("App.Sample.xlsx");
IWorkbook workbook = application.Workbooks.Open(fileStream);
IWorksheet worksheet = workbook.Worksheets[0];
//Sample data
worksheet.Range["A1:K20"].Text = "Locked";
//A1:A10 will not be protected, hence it is editable.
worksheet.Range["A1:A10"].CellStyle.Locked = false;
worksheet.Range["A1:A10"].Text = "UnLocked";
worksheet.Protect("syncfusion", ExcelSheetProtection.All);
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("ProtectCells.xlsx", "application/msexcel", stream);
}
{% endhighlight %}
{% endtabs %}
N> Locking/Unlocking cells in an unprotected worksheet has no effect.
## See Also
* [How to protect Excel workbook?](https://help.syncfusion.com/file-formats/xlsio/migrate-from-office-automation-to-syncfusion-xlsio/protect-excel-workbook)
* [How to protect worksheet?](https://help.syncfusion.com/file-formats/xlsio/security#protect-worksheet)
* [How to protect the zip files using Syncfusion.Compression.Base?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-protect-the-zip-files-using-syncfusion-compression-base)
* [How to un-protect the zip files using Syncfusion.Compression.Base?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-un-protect-the-zip-files-using-syncfusion-compression-base)

Просмотреть файл

@ -0,0 +1,72 @@
---
title: Protect the zip files with password | Syncfusion
description: This page demonstrates how to protect the zip files with password using Syncfusion.Compression.Base.
platform: File-formats
control: XlsIO
documentation: UG
---
# How to protect the zip files using Syncfusion.Compression.Base?
Password is used for protecting files which needs more security. This can be achieved by using various encryption algorithms. The compressed zip files can be protected using encryption algorithms with password as a key for that algorithm.
Syncfusion.Compression.Base supports AES-128 bits, AES-192 bits, AES-256 bits and ZipCrypto encryption algorithms. These encryption algorithms are available under the enumeration **EncryptionAlgorithm**.
The following complete code snippet explains how to protect a zip file with password using AES-256 bits encryption algorithm.
{% tabs %}
{% highlight c# %}
using Syncfusion.Compression.Zip;
class Program
{
static void Main(string[] args)
{
//Initialize ZipArchive
ZipArchive zipArchive = new ZipArchive();
//Add files into ZipArchive
zipArchive.AddFile("../../Data/Template1.txt");
zipArchive.AddFile("../../Data/Template2.txt");
zipArchive.AddFile("../../Data/Template3.txt");
//Protect the ZipArchive with password
zipArchive.Protect("password", EncryptionAlgorithm.AES256);
//Save the ZipArchive
zipArchive.Save("WithPassword256Bit.zip");
}
}
{% endhighlight %}
{% highlight vb %}
Imports Syncfusion.Compression.Zip
Module Module1
Sub Main()
'Initialize ZipArchive
Dim zipArchive As ZipArchive = New ZipArchive
'Add files into ZipArchive
zipArchive.AddFile("../../Data/Template1.txt")
zipArchive.AddFile("../../Data/Template2.txt")
zipArchive.AddFile("../../Data/Template3.txt")
'Protect the ZipArchive with password
zipArchive.Protect("password", EncryptionAlgorithm.AES256)
'Save the ZipArchive
zipArchive.Save("WithPassword256Bit.zip")
End Sub
End Module
{% endhighlight %}
{% endtabs %}
## See Also
* [How to un-protect the zip files using Syncfusion.Compression.Base?](faqs/how-to-un-protect-the-zip-files-using-syncfusion-compression-base)
* [How to zip files using the Syncfusion.Compression.Zip namespace?](faqs/how-to-zip-files-using-the-syncfusion-compression-zip-namespace)
* [How to zip all the files in subfolders using Syncfusion Compression?](faqs/how-to-zip-all-the-files-in-subfolders-using-syncfusion-compression)
* [How to protect certain cells in a worksheet?](faqs/how-to-protect-certain-cells-in-a-worksheet)
* [How to protect Excel workbook?](https://help.syncfusion.com/file-formats/xlsio/migrate-from-office-automation-to-syncfusion-xlsio/protect-excel-workbook)
* [How to protect worksheet?](https://help.syncfusion.com/file-formats/xlsio/security#protect-worksheet)

Просмотреть файл

@ -0,0 +1,213 @@
---
title: FAQ Section| XlsIO | Syncfusion
description: This page shows how to resolve "Excel cannot open the file because the file format is not valid..." using XlsIO.
platform: File-formats
control: XlsIO
documentation: UG
---
# How to resolve "Excel cannot open the file 'filename.xlsx'..." error?
This error "Excel cannot open the file 'filename.xlsx' because the file format for the file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file" occurs when there is a mismatch between the file format and its extension. The default workbook creation version in XlsIO is Excel97-2003 (.xls). The application version set to the required version should match its file format during save, as in the below code.
{% tabs %}
{% highlight c# %}
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
//Set application version
application.DefaultVersion = ExcelVersion.Excel2013;
//Do some manipulation
//Do some manipulation
//Workbook is saved in Excel2013 format
workbook.SaveAs("Sample.xlsx");
{% endhighlight %}
{% highlight vb %}
Dim excelEngine As New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
'Set application version
application.DefaultVersion = ExcelVersion.Excel2013
'Do some manipulation
'Do some manipulation
'Workbook is saved in Excel2013 format
workbook.SaveAs("Sample.xlsx")
{% endhighlight %}
{% highlight UWP %}
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
//Set application version
application.DefaultVersion = ExcelVersion.Excel2013;
//Do some manipulation
//Do some manipulation
//Workbook is saved in Excel2013 format
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "Sample";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile storageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await workbook.SaveAsAsync(storageFile);
{% endhighlight %}
{% highlight ASP.NET Core %}
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
//Set application version
application.DefaultVersion = ExcelVersion.Excel2013;
//Do some manipulation
//Do some manipulation
//Workbook is saved in Excel2013 format
FileStream stream = new FileStream("Sample.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(stream);
{% endhighlight %}
{% highlight Xamarin %}
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
//Set application version
application.DefaultVersion = ExcelVersion.Excel2013;
//Do some manipulation
//Do some manipulation
//Workbook is saved in Excel2013 format
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("Sample.xlsx", "application/msexcel", stream);
{% endhighlight %}
{% endtabs %}
If the application version is ignored, then the workbook version should be set properly during creation and save.
* To save a workbook in Excel2003 format, set the workbook version to Excel97to2003 and save the file with extension .xls i.e. binary file format.
* To save a workbook in Excel 2007 and above formats, set the workbook version to Excel2007 and above and save the file with extension __.____xlsx__ i.e. open XML file format.
These are represented in the below code snippet.
{% tabs %}
{% highlight c# %}
workbook.Version = ExcelVersion.Excel97to2003;
workbook.SaveAs("Sample.xls");
workbook.Version = ExcelVersion.Excel2013;
workbook.SaveAs("Sample.xlsx");
{% endhighlight %}
{% highlight vb %}
workbook.Version = ExcelVersion.Excel97to2003
workbook.SaveAs("Sample.xls")
workbook.Version = ExcelVersion.Excel2013
workbook.SaveAs("Sample.xlsx")
{% endhighlight %}
{% highlight UWP %}
workbook.Version = ExcelVersion.Excel97to2003;
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "Sample";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xls" });
StorageFile storageFile = await savePicker.PickSaveFileAsync();
await workbook.SaveAsAsync(storageFile);
workbook.Version = ExcelVersion.Excel2013;
FileSavePicker savePicker1 = new FileSavePicker();
savePicker1.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker1.SuggestedFileName = "Sample";
savePicker1.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
StorageFile storageFile1 = await savePicker1.PickSaveFileAsync();
await workbook.SaveAsAsync(storageFile1);
{% endhighlight %}
{% highlight ASP.NET Core %}
workbook.Version = ExcelVersion.Excel97to2003;
FileStream stream = new FileStream("Sample.xls", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(stream);
workbook.Version = ExcelVersion.Excel2013;
FileStream stream1 = new FileStream("Sample.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(stream1);
{% endhighlight %}
{% highlight Xamarin %}
workbook.Version = ExcelVersion.Excel97to2003;
//SaveAndView method is not implemented to save and open .xls files. Hence, saving it as stream.
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("Output.xls", "application/vnd.ms-excel", stream);
workbook.Version = ExcelVersion.Excel2013;
MemoryStream stream1 = new MemoryStream();
workbook.SaveAs(stream1);
stream1.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("Sample.xlsx", "application/msexcel", stream1);
{% endhighlight %}
{% endtabs %}
## See Also
* [How to resolve the File does not contain workbook stream error in Syncfusion.XlsIO.Base.dll?](faqs/how-to-resolve-the-file-does-not-contain-workbook-stream-error-in-syncfusion-xlsio-base-dll)
* [What are the known exceptions of XlsIO?](https://help.syncfusion.com/file-formats/xlsio/known-exceptions)
* [What are the supported features by file formats?](https://help.syncfusion.com/file-formats/xlsio/supported-features-by-file-formats)

Просмотреть файл

@ -0,0 +1,83 @@
---
title: Resolve the File does not contain workbook stream error | Syncfusion
description: This page explains how to resolve the "File does not contain workbook stream" error in Syncfusion.XlsIO.Base.dll.
platform: File-formats
control: XlsIO
documentation: UG
---
# How to resolve the “File does not contain workbook stream” error?
XlsIO does not support files generated prior to 97-2003 version. Hence the exception "File does not contain workbook stream" occurs. This can be checked in prior with the below code snippet.
{% tabs %}
{% highlight c# %}
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
//To check whether the file is supported
var isSupported = application.IsSupported("Sample.xls");
excelEngine.Dispose();
{% endhighlight %}
{% highlight vb %}
Dim excelEngine As New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
'To check whether the file is supported
Dim isSupported = application.IsSupported("Sample.xls")
excelEngine.Dispose()
{% endhighlight %}
{% highlight UWP %}
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
//To check whether the file is supported
FileStream stream = new FileStream("Sample.xls", FileMode.OpenOrCreate, FileAccess.ReadWrite);
var isSupported = application.IsSupported(stream);
excelEngine.Dispose();
{% endhighlight %}
{% highlight ASP.NET Core %}
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
//To check whether the file is supported
FileStream stream = new FileStream("Sample.xls", FileMode.OpenOrCreate, FileAccess.ReadWrite);
var isSupported = application.IsSupported(stream);
excelEngine.Dispose();
{% endhighlight %}
{% highlight Xamarin %}
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
//To check whether the file is supported
FileStream stream = new FileStream("Sample.xls", FileMode.OpenOrCreate, FileAccess.ReadWrite);
var isSupported = application.IsSupported(stream);
excelEngine.Dispose();
{% endhighlight %}
{% endtabs %}
N> This method is available from 12.4 version onwards.
## See Also
* [How to resolve Excel cannot open the file filename.xlsx... error?](faqs/how-to-resolve-excel-cannot-open-the-file-because-the-file-format-for-the-file-extension-is-not-valid)
* [What are the known exceptions of XlsIO?](https://help.syncfusion.com/file-formats/xlsio/known-exceptions)
* [How to open an Excel file from stream?](faqs/how-to-open-an-excel-file-from-stream)
* [How to save a file to stream?](faqs/how-to-save-a-file-to-stream)

Просмотреть файл

@ -0,0 +1,105 @@
---
title: How to save a file to stream | XlsIO | Syncfusion
description: This page demonstrates with an example to save a file to stream using Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to save a file to stream?
XlsIO provides support to save a workbook to a .NET stream. The following code snippet illustrates this.
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic);
//Save the workbook to stream
FileStream fileStream = new FileStream("Output.xlsx", FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite);
workbook.SaveAs(fileStream);
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic)
'Save the workbook to stream
Dim fileStream As New FileStream("Output.xlsx", FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite)
workbook.SaveAs(fileStream)
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
Stream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = await application.Workbooks.OpenAsync(inputStream, ExcelOpenType.Automatic);
//Save the workbook to stream
FileStream fileStream = new FileStream("Output.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
await workbook.SaveAsAsync(fileStream);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic);
//Save the workbook to stream
FileStream fileStream = new FileStream("Output.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(fileStream);
workbook.Close();
excelEngine.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
Stream inputStream = assembly.GetManifestResourceStream("App.Sample.xlsx");
IWorkbook workbook = application.Workbooks.Open(inputStream);
//Save the workbook to stream
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("Output.xlsx", "application/msexcel", stream);
}
{% endhighlight %}
{% endtabs %}
## See Also
* [How to open an Excel file from stream?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-open-an-excel-file-from-stream)
[How to save an Excel workbook to stream?](https://help.syncfusion.com/file-formats/xlsio/loading-and-saving-workbook#saving-a-excel-workbook-to-stream)
* [How to resolve the File does not contain workbook stream error in Syncfusion.XlsIO.Base.dll?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-resolve-the-file-does-not-contain-workbook-stream-error)
* [How to resolve Excel cannot open the file filename.xlsx... error?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-resolve-excel-cannot-open-the-file-because-the-file-format-for-the-file-extension-is-not-valid)
* [How to open an existing XLSX workbook and save it as XLS?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-open-an-existing-xlsx-workbook-and-save-it-as-xls)
* [How to merge excel files from more than one workbook to a single file?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-merge-excel-files-from-more-than-one-workbook-to-a-single-file)
* [Does XlsIO support Excel files with macros that are digitally signed?](https://help.syncfusion.com/file-formats/xlsio/faqs/does-xlsio-support-excel-files-with-macros-that-are-digitally-signed)
* [How does Excel file with uninstalled fonts is converted to PDF/Image?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-does-excel-file-with-uninstalled-fonts-is-converted-to-pdf-image)

Просмотреть файл

@ -0,0 +1,140 @@
---
title: How to set a line break inside a cell | XlsIO | Syncfusion
description: This page illustrates on how to set a line break inside a cell using Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to set a line break inside a cell?
In order to set a line break inside a cell, you have to enable Text Wrapping for the cell, and then break the text. The following code snippet illustrates this.
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Save the line break inside the cell
worksheet.Range["A1"].CellStyle.WrapText = true;
worksheet.Range["A1"].Text = String.Format("Hello\nworld");
workbook.SaveAs("LineBreak.xlsx");
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
Dim workbook As IWorkbook = application.Workbooks.Create(1)
Dim worksheet As IWorksheet = workbook.Worksheets(0)
'Save the line break inside the cell
worksheet.Range("A1").CellStyle.WrapText = True
worksheet.Range("A1").Text = String.Format("Hello" & vbLf & "world")
workbook.SaveAs("LineBreak.xlsx")
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Save the line break inside the cell
worksheet.Range["A1"].CellStyle.WrapText = true;
worksheet.Range["A1"].Text = String.Format("Hello\nworld");
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "LineBreak";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile storageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await workbook.SaveAsAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Save the line break inside the cell
worksheet.Range["A1"].CellStyle.WrapText = true;
worksheet.Range["A1"].Text = String.Format("Hello\nworld");
FileStream stream = new FileStream("LineBreak.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(stream);
workbook.Close();
excelEngine.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Save the line break inside the cell
worksheet.Range["A1"].CellStyle.WrapText = true;
worksheet.Range["A1"].Text = String.Format("Hello\nworld");
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("LineBreak.xlsx", "application/msexcel", stream);
}
{% endhighlight %}
{% endtabs %}
## See Also
* [How to format text within a cell?](faqs/how-to-format-text-within-a-cell)
* [How to protect certain cells in a worksheet?](faqs/how-to-protect-certain-cells-in-a-worksheet)
* [How to copy/paste the cell values that contain only formula?](faqs/how-to-copy-paste-the-cell-values-that-contain-only-formula)
* [How to change the grid line color of the Excel sheet?](how-to-change-the-grid-line-color-of-the-excel-sheet)
* [How to show or hide gridlines?](https://help.syncfusion.com/file-formats/xlsio/working-with-excel-worksheet#show-or-hide-grid-lines)
* [How to apply wrap text?](https://help.syncfusion.com/file-formats/xlsio/working-with-cell-or-range-formatting#apply-wrap-text)

Просмотреть файл

@ -0,0 +1,126 @@
---
title: How to set or format a Header/Footer | XlsIO | Syncfusion
description: This page explains with an example to set or format a Header/Footer using Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to set or format a Header/Footer?
Script commands are used to set header/ footer formatting. The following code snippet illustrate this. For more information on formatting the string, see [Inserting and Formatting Text in Headers and Footers](https://docs.microsoft.com/en-us/previous-versions/office/developer/office-2007/bb225426(v=office.12))
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Format the header
worksheet.PageSetup.CenterHeader = @"&""Gothic,bold""Center Header Text";
workbook.SaveAs("HeaderFormat.xlsx");
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
Dim workbook As IWorkbook = application.Workbooks.Create(1)
Dim worksheet As IWorksheet = workbook.Worksheets(0)
'Format the header
worksheet.PageSetup.CenterHeader = "&""Gothic,bold""Center Header Text"
workbook.SaveAs("HeaderFormat.xlsx")
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Format the header
worksheet.PageSetup.CenterHeader = @"&""Gothic,bold""Center Header Text";
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "HeaderFormat";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile storageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await workbook.SaveAsAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Format the header
worksheet.PageSetup.CenterHeader = @"&""Gothic,bold""Center Header Text";
FileStream stream = new FileStream("HeaderFormat.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(stream);
workbook.Close();
excelEngine.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Format the header
worksheet.PageSetup.CenterHeader = @"&""Gothic,bold""Center Header Text";
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("HeaderFormat.xlsx", "application/msexcel", stream);
}
{% endhighlight %}
{% endtabs %}
N> Go to “ View -> Page Layout” option to view the header and footer in Microsoft Excel.
## See Also
* [How to enable/disable header footer?](https://help.syncfusion.com/file-formats/xlsio/excel-to-pdf-converter-settings#header-footer-option)
* [What are page setup settings?](https://help.syncfusion.com/file-formats/xlsio/working-with-excel-worksheet#page-setup-settings)
* [How to set a line break inside a cell?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-set-a-line-break-inside-a-cell)
* [How to set print titles?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-set-print-titles)
* [How to format text within a cell?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-format-text-within-a-cell)

Просмотреть файл

@ -0,0 +1,252 @@
---
title: How to set print titles | XlsIO | Syncfusion
description: This page demonstrates with an example to set print titles using Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to set print titles?
**Printing** **Title** **Rows**
XlsIO allows to designate row header to repeat on all pages of a printed workbook using **PrintTitleRows** property. The following code snippet illustrates this.
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];
//Print Rows 1 to 3 on every printed page
worksheet.PageSetup.PrintTitleRows = "$A$1:$IV$3";
workbook.SaveAs("TitleRows.xlsx");
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic)
Dim worksheet As IWorksheet = workbook.Worksheets(0)
'Print Rows 1 to 3 on every printed page
worksheet.PageSetup.PrintTitleRows = "$A$1:$IV$3"
workbook.SaveAs("TitleRows.xlsx")
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
Stream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = await application.Workbooks.OpenAsync(inputStream, ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];
//Print Rows 1 to 3 on every printed page
worksheet.PageSetup.PrintTitleRows = "$A$1:$IV$3";
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "TitleRows";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile storageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await workbook.SaveAsAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];
//Print Rows 1 to 3 on every printed page
worksheet.PageSetup.PrintTitleRows = "$A$1:$IV$3";
FileStream stream = new FileStream("TitleRows.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(stream);
workbook.Close();
excelEngine.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
Stream fileStream = assembly.GetManifestResourceStream("App.Sample.xlsx");
IWorkbook workbook = application.Workbooks.Open(fileStream);
IWorksheet worksheet = workbook.Worksheets[0];
//Print Rows 1 to 3 on every printed page
worksheet.PageSetup.PrintTitleRows = "$A$1:$IV$3";
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("TitleRows.xlsx", "application/msexcel", stream);
}
{% endhighlight %}
{% endtabs %}
**Printing** **Title** **Columns**
XlsIO allows to designate column header to repeat on all pages of a printed workbook using **PrintTitleColumns** property. The following code illustrates printing Title Columns.
{% tabs %}
{% highlight c# %}
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];
//Print Columns 1 to 3 on every printed page
worksheet.PageSetup.PrintTitleColumns = "$A$1:$C$65536";
workbook.SaveAs("TitleColumns.xlsx");
workbook.Close();
excelEngine.Dispose();
{% endhighlight %}
{% highlight vb %}
Dim excelEngine As New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic)
Dim worksheet As IWorksheet = workbook.Worksheets(0)
'Print Columns 1 to 3 on every printed page
worksheet.PageSetup.PrintTitleColumns = "$A$1:$C$65536"
workbook.SaveAs("TitleColumns.xlsx")
workbook.Close()
excelEngine.Dispose()
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
Stream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = await application.Workbooks.OpenAsync(inputStream, ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];
//Print Columns 1 to 3 on every printed page
worksheet.PageSetup.PrintTitleColumns = "$A$1:$C$65536";
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "TitleColumns";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile storageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await workbook.SaveAsAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];
//Print Columns 1 to 3 on every printed page
worksheet.PageSetup.PrintTitleColumns = "$A$1:$C$65536";
FileStream stream = new FileStream("TitleColumns.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(stream);
workbook.Close();
excelEngine.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
Stream fileStream = assembly.GetManifestResourceStream("App.Sample.xlsx");
IWorkbook workbook = application.Workbooks.Open(fileStream);
IWorksheet worksheet = workbook.Worksheets[0];
//Print Columns 1 to 3 on every printed page
worksheet.PageSetup.PrintTitleColumns = "$A$1:$C$65536";
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("TitleColumns.xlsx", "application/msexcel", stream);
}
{% endhighlight %}
{% endtabs %}
For information on Print settings, refer to section [Page Setup Settings](/file-formats/xlsio/working-with-excel-worksheet#page-setup-settings).
## See Also
* [How to ignore print areas set in a worksheet?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-ignore-print-areas-set-in-a-worksheet)
* [How to set a line break inside a cell?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-set-a-line-break-inside-a-cell)
* [How to set or format a Header/Footer?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-set-or-format-a-header-footer)
* [How to print Excel document?](https://help.syncfusion.com/file-formats/xlsio/excel-to-pdf-conversion#print-excel-document)
* [What are page setup settings?](https://help.syncfusion.com/file-formats/xlsio/working-with-excel-worksheet#page-setup-settings)

Просмотреть файл

@ -0,0 +1,156 @@
---
title: How to sort two or more columns in a pivot table | Syncfusion
description: Code example to sort two or more columns in a pivot table using Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to sort two or more columns in a pivot table?
You can sort two or more columns in a pivot table by using the **AutoSort()** method each time with the respective column index. The following code snippet illustrates this.
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2016;
IWorkbook workbook = application.Workbooks.Open("PivotTable.xlsx");
IWorksheet worksheet = workbook.Worksheets[1];
IPivotTable pivotTable = worksheet.PivotTables[0];
IPivotField rowField = pivotTable.RowFields[1];
//Pivot Top to Bottom sorting of values in 4th column (D) of the pivot table, (i.e.) 3rd data column
//assuming that the pivot table starts from 1st column (A) and data columns start from 2nd column (B)
rowField.AutoSort(PivotFieldSortType.Ascending, 3);
//Pivot Top to Bottom sorting of values in 5th column (E) of the pivot table, (i.e.) 4th data column
rowField.AutoSort(PivotFieldSortType.Ascending, 4);
string fileName = "TopToBottomSort.xlsx";
workbook.SaveAs(fileName);
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2016
Dim workbook As IWorkbook = application.Workbooks.Open("PivotTable.xlsx")
Dim worksheet As IWorksheet = workbook.Worksheets(1)
Dim pivotTable As IPivotTable = worksheet.PivotTables(0)
Dim rowField As IPivotField = pivotTable.RowFields(1)
'Pivot Top to Bottom sorting of values in 4th column (D) of the pivot table, (i.e.) 3rd data column
'assuming that the pivot table starts from 1st column (A) and data columns start from 2nd column (B)
rowField.AutoSort(PivotFieldSortType.Ascending, 3)
'Pivot Top to Bottom sorting of values in 5th column (E) of the pivot table, (i.e.) 4th data column
rowField.AutoSort(PivotFieldSortType.Ascending, 4)
Dim fileName As String = "TopToBottomSort.xlsx"
workbook.SaveAs(fileName)
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
Stream inputStream = new FileStream("PivotTable.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = await application.Workbooks.OpenAsync(inputStream, ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[1];
IPivotTable pivotTable = worksheet.PivotTables[0];
IPivotField rowField = pivotTable.RowFields[1];
//Pivot Top to Bottom sorting of values in 4th column (D) of the pivot table, (i.e.) 3rd data column
//assuming that the pivot table starts from 1st column (A) and data columns start from 2nd column (B)
rowField.AutoSort(PivotFieldSortType.Ascending, 3);
//Pivot Top to Bottom sorting of values in 5th column (E) of the pivot table, (i.e.) 4th data column
rowField.AutoSort(PivotFieldSortType.Ascending, 4);
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "TopToBottomSort";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile storageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await workbook.SaveAsAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
FileStream inputStream = new FileStream("PivotTable.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[1];
IPivotTable pivotTable = worksheet.PivotTables[0];
IPivotField rowField = pivotTable.RowFields[1];
//Pivot Top to Bottom sorting of values in 4th column (D) of the pivot table, (i.e.) 3rd data column
//assuming that the pivot table starts from 1st column (A) and data columns start from 2nd column (B)
rowField.AutoSort(PivotFieldSortType.Ascending, 3);
//Pivot Top to Bottom sorting of values in 5th column (E) of the pivot table, (i.e.) 4th data column
rowField.AutoSort(PivotFieldSortType.Ascending, 4);
FileStream stream = new FileStream("TopToBottomSort.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(stream);
workbook.Close();
excelEngine.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
Stream fileStream = assembly.GetManifestResourceStream("App.PivotTable.xlsx");
IWorkbook workbook = application.Workbooks.Open(fileStream);
IWorksheet worksheet = workbook.Worksheets[1];
IPivotTable pivotTable = worksheet.PivotTables[0];
IPivotField rowField = pivotTable.RowFields[1];
//Pivot Top to Bottom sorting of values in 4th column (D) of the pivot table, (i.e.) 3rd data column
//assuming that the pivot table starts from 1st column (A) and data columns start from 2nd column (B)
rowField.AutoSort(PivotFieldSortType.Ascending, 3);
//Pivot Top to Bottom sorting of values in 5th column (E) of the pivot table, (i.e.) 4th data column
rowField.AutoSort(PivotFieldSortType.Ascending, 4);
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("TopToBottomSort.xlsx", "application/msexcel", stream);
}
{% endhighlight %}
{% endtabs %}
## See Also
* [What is the maximum range of Rows and Columns?](faqs/what-is-the-maximum-range-of-rows-and-columns)
* [How to unfreeze the rows and columns in XlsIO?](faqs/how-to-unfreeze-the-rows-and-columns-in-xlsio)
* [How to hide the summary rows and columns using XlsIO?](faqs/how-to-hide-the-summary-rows-and-columns-using-xlsio)
* [How to merge excel files from more than one workbook to a single file?](faqs/how-to-merge-excel-files-from-more-than-one-workbook-to-a-single-file)
* [What is data sorting?](https://help.syncfusion.com/file-formats/xlsio/worksheet-cells-manipulation#data-sorting)
* [How to sort by value in Pivot Table?](https://help.syncfusion.com/file-formats/xlsio/working-with-pivot-tables#sort-by-value-in-pivot-table)
* [How to filter Excel data?](https://help.syncfusion.com/file-formats/xlsio/migrate-from-office-automation-to-syncfusion-xlsio/filter-excel-data)

Просмотреть файл

@ -0,0 +1,66 @@
---
title: Un-protect zip files using Syncfusion.Compression.Base | Syncfusion
description: This page demonstrates with an example to un-protect the zip files using Syncfusion.Compression.Base.
platform: File-formats
control: XlsIO
documentation: UG
---
# How to un-protect the zip files using Syncfusion.Compression.Base?
The following complete code snippet explains how to unprotect the zip file.
{% tabs %}
{% highlight c# %}
using Syncfusion.Compression.Zip;
using System.IO;
class Program
{
static void Main(string[] args)
{
//Initailize ZipArchive
ZipArchive zipArchive = new ZipArchive();
//Load the zip file into ZipArchive
zipArchive.Open(new FileStream("../../Data/Protected.zip", FileMode.Open), false, "password");
//Unprotect the ZipArchive
zipArchive.UnProtect();
//Save the ZipArchive
zipArchive.Save("WithOutPassword.zip");
}
}
{% endhighlight %}
{% highlight vb %}
Imports Syncfusion.Compression.Zip
Imports System.IO
Module Module1
Sub Main()
'Initailize ZipArchive
Dim zipArchive As ZipArchive = New ZipArchive
'Load the zip file into ZipArchive
zipArchive.Open(New FileStream("../../Data/Protected.zip", FileMode.Open), False, "password")
'Unprotect the ZipArchive
zipArchive.UnProtect()
'Save the ZipArchive
zipArchive.Save("WithOutPassword.zip")
End Sub
End Module
{% endhighlight %}
{% endtabs %}
## See Also
* [How to protect the zip files using Syncfusion.Compression.Base?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-protect-the-zip-files-using-syncfusion-compression-base)
* [How to zip files using the Syncfusion.Compression.Zip namespace?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-zip-files-using-the-syncfusion-compression-zip-namespace)
* [How to zip all the files in subfolders using Syncfusion Compression?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-zip-all-the-files-in-subfolders-using-syncfusion-compression)
* [How to protect certain cells in a worksheet?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-protect-certain-cells-in-a-worksheet)
* [How to unprotect Excel workbook?](https://help.syncfusion.com/file-formats/xlsio/migrate-from-office-automation-to-syncfusion-xlsio/unprotect-excel-workbook)
* [How to protect worksheet?](https://help.syncfusion.com/file-formats/xlsio/security#protect-worksheet)

Просмотреть файл

@ -0,0 +1,141 @@
---
title: How to unfreeze the rows and columns in XlsIO | XlsIO | Syncfusion
description: This page demonstrates with an example to unfreeze the rows and columns using Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to unfreeze the rows and columns in XlsIO?
You can unfreeze rows and columns in XlsIO by using the RemovePanes method. The following code snippet illustrates this.
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];
//Freeze the panes
worksheet.Range[8, 1].FreezePanes();
//Unfreeze the panes
worksheet.RemovePanes();
workbook.SaveAs("Unfreeze.xlsx");
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic)
Dim worksheet As IWorksheet = workbook.Worksheets(0)
'Freeze the panes
worksheet.Range(8, 1).FreezePanes()
'Unfreeze the panes
worksheet.RemovePanes()
workbook.SaveAs("Unfreeze.xlsx")
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
Stream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = await application.Workbooks.OpenAsync(inputStream, ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];
//Freeze the panes
worksheet.Range[8, 1].FreezePanes();
//Unfreeze the panes
worksheet.RemovePanes();
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "Unfreeze";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile storageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await workbook.SaveAsAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];
//Freeze the panes
worksheet.Range[8, 1].FreezePanes();
//Unfreeze the panes
worksheet.RemovePanes();
FileStream stream = new FileStream("Unfreeze.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(stream);
workbook.Close();
excelEngine.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
Stream fileStream = assembly.GetManifestResourceStream("App.Sample.xlsx");
IWorkbook workbook = application.Workbooks.Open(fileStream);
IWorksheet worksheet = workbook.Worksheets[0];
//Freeze the panes
worksheet.Range[8, 1].FreezePanes();
//Unfreeze the panes
worksheet.RemovePanes();
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("Unfreeze.xlsx", "application/msexcel", stream);
}
{% endhighlight %}
{% endtabs %}
## See Also
* [What is the maximum range of Rows and Columns?](faqs/what-is-the-maximum-range-of-rows-and-columns)
* [How to hide the summary rows and columns using XlsIO?](faqs/how-to-hide-the-summary-rows-and-columns-using-xlsio)
* [How to sort two or more columns in a pivot table?](faqs/how-to-sort-two-or-more-columns-in-a-pivot-table)
* [How to freeze panes?](https://help.syncfusion.com/file-formats/xlsio/working-with-excel-worksheet#freeze-panes)
* [How to unfreeze panes?](https://help.syncfusion.com/file-formats/xlsio/working-with-excel-worksheet#unfreeze-panes)
* [How to split panes?](https://help.syncfusion.com/file-formats/xlsio/working-with-excel-worksheet#split-panes)

Просмотреть файл

@ -0,0 +1,225 @@
---
title: How to use Named Ranges with XlsIO | Syncfusion
description: This page demonstrates with an example on how to use named ranges in Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to use Named Ranges with XlsIO?
A named range can be added to worksheet or workbook based on the required scope, the following code snippet illustrate this. For more information, see [Named Range](https://support.office.com/en-us/article/Define-and-use-names-in-formulas-4d0f13ac-53b7-422e-afd2-abd7ff379c64)
{% tabs %}
{% highlight c# %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Adding named range to the workbook
IName workBookName = workbook.Names.Add("WorkBookName");
workBookName.RefersToRange = worksheet.Range["I8"];
//Looping through the Named Ranges in a workbook.
foreach (IName workbookName in workbook.Names)
{
MessageBox.Show(workbookName.Name.ToString());
}
//Adding named range to the worksheet
IName worksheetName = worksheet.Names.Add("WorkSheetName");
worksheetName.RefersToRange = worksheet.Range["J8"];
//Looping through the Named Ranges in a worksheet.
foreach (IName name in worksheet.Names)
{
MessageBox.Show(name.Name.ToString());
}
workbook.SaveAs("NamedRange.Xlsx");
}
{% endhighlight %}
{% highlight vb %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
Dim workbook As IWorkbook = application.Workbooks.Create(1)
Dim worksheet As IWorksheet = workbook.Worksheets(0)
'Adding named range to the workbook
Dim workBookName__1 As IName = workbook.Names.Add("WorkBookName")
workBookName__1.RefersToRange = worksheet.Range("I8")
'Looping through the Named Ranges in a workbook.
For Each workbookName__2 As IName In workbook.Names
MessageBox.Show(workbookName__2.Name.ToString())
Next
'Adding named range to the worksheet
Dim worksheetName__3 As IName = worksheet.Names.Add("WorkSheetName")
worksheetName__3.RefersToRange = worksheet.Range("J8")
'Looping through the Named Ranges in a worksheet.
For Each worksheetName__4 As IName In worksheet.Names
MessageBox.Show(worksheetName__4.Name.ToString())
Next
workbook.SaveAs("NamedRange.Xlsx")
End Using
{% endhighlight %}
{% highlight UWP %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Adding named range to the workbook
IName workBookName = workbook.Names.Add("WorkBookName");
workBookName.RefersToRange = worksheet.Range["I8"];
//Looping through the Named Ranges in a workbook
foreach (IName workbookName in workbook.Names)
{
MessageDialog showDialog = new MessageDialog(workbookName.Name.ToString());
}
//Adding named range to the worksheet
IName worksheetName = worksheet.Names.Add("WorkSheetName");
worksheetName.RefersToRange = worksheet.Range["J8"];
//Looping through the Named Ranges in a worksheet
foreach (IName name in worksheet.Names)
{
MessageDialog showDialog = new MessageDialog(name.Name.ToString());
}
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "NamedRange";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile storageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await workbook.SaveAsAsync(storageFile);
}
{% endhighlight %}
{% highlight ASP.NET Core %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Adding named range to the workbook
IName workBookName = workbook.Names.Add("WorkBookName");
workBookName.RefersToRange = worksheet.Range["I8"];
//Looping through the Named Ranges in a workbook
foreach (IName workbookName in workbook.Names)
{
MessageBox.Show(workbookName.Name.ToString());
}
//Adding named range to the worksheet
IName worksheetName = worksheet.Names.Add("WorkSheetName");
worksheetName.RefersToRange = worksheet.Range["J8"];
//Looping through the Named Ranges in a worksheet
foreach (IName name in worksheet.Names)
{
MessageBox.Show(name.Name.ToString());
}
FileStream stream = new FileStream("NamedRange.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
workbook.SaveAs(stream);
workbook.Close();
excelEngine.Dispose();
}
{% endhighlight %}
{% highlight Xamarin %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Adding named range to the workbook
IName workBookName = workbook.Names.Add("WorkBookName");
workBookName.RefersToRange = worksheet.Range["I8"];
//Looping through the Named Ranges in a workbook
foreach (IName workbookName in workbook.Names)
{
MessageBox.Show(workbookName.Name.ToString());
}
//Adding named range to the worksheet
IName worksheetName = worksheet.Names.Add("WorkSheetName");
worksheetName.RefersToRange = worksheet.Range["J8"];
//Looping through the Named Ranges in a worksheet
foreach (IName name in worksheet.Names)
{
MessageBox.Show(name.Name.ToString());
}
MemoryStream stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Position = 0;
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("NamedRange.xlsx", "application/msexcel", stream);
}
{% endhighlight %}
{% endtabs %}
## See Also
* [How to avoid exception when adding worksheets with same name?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-avoid-exception-when-adding-worksheets-with-same-name)
* [How to create named range in Excel?](https://help.syncfusion.com/file-formats/xlsio/migrate-from-office-automation-to-syncfusion-xlsio/create-named-range-in-excel)
* [How to create a sparkline from a named range?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-create-a-sparkline-from-a-named-range)
* [How to define names?](https://help.syncfusion.com/file-formats/xlsio/working-with-formulas#defined-names)
* [How to use named ranges in formulas?](https://help.syncfusion.com/file-formats/xlsio/working-with-formulas#named-ranges-in-formulas)
* [In which situation we use AutoDetectComplexScript converter property?](https://help.syncfusion.com/file-formats/xlsio/faqs/in-which-situation-we-use-autodetectcomplexscript-converter-property)

Просмотреть файл

@ -0,0 +1,399 @@
---
title: Zip all files in subfolders using Syncfusion's Compression |Syncfusion
description: This page illustrates with an example to zip all the files in subfolders using the Syncfusion.Compression.Zip namespace.
platform: File-formats
control: XlsIO
documentation: UG
---
# How to zip all the files in subfolders using Syncfusion's Compression?
You can compress and decompress the files with our Compression library. The following code snippet illustrates this.
{% tabs %}
{% highlight c# %}
using Syncfusion.Compression.Zip;
class Program
{
private static List<DirectoryInfo> arrOfItems = new List<DirectoryInfo>();
private static ZipArchive zipArchive = new ZipArchive();
private static string folderPath = @"..\..\ZipFiles";
private static void SubFoldersFiles(string path)
{
DirectoryInfo dInfo = new DirectoryInfo(path);
foreach (DirectoryInfo d in dInfo.GetDirectories())
{
SubFoldersFiles(d.FullName);
arrOfItems.Add(d);
}
}
// Zip and save the file.
private static void ZipAndSave()
{
SubFoldersFiles(folderPath);
if (Directory.Exists(folderPath))
{
AddRootFiles();
AddSubFoldersFiles();
// Saving zipped file.
zipArchive.Save(@"..\..\UnzippedFile.zip");
zipArchive.Close();
Console.WriteLine("Files Zipped successfully!");
}
}
private static void AddRootFiles()
{
string fileName = "";
foreach (string rootFiles in Directory.GetFiles(folderPath))
{
//Creating the stream from file
FileStream stream = new FileStream(rootFiles, FileMode.Open, FileAccess.ReadWrite);
//Getting the File Name alone and ignoring the directory path
fileName = Path.GetFileName(rootFiles);
FileAttributes attribute = File.GetAttributes(rootFiles);
zipArchive.AddItem(fileName, stream, false, attribute);
}
}
private static void AddSubFoldersFiles()
{
foreach (DirectoryInfo dInfo in arrOfItems)
{
FileInfo[] fInfo = dInfo.GetFiles();
string mainDirectoryPath = Path.GetFullPath(folderPath);
foreach (FileInfo file in fInfo)
{
//Get the File name with its current folder and ignoring the Main Directory
string fileName = file.FullName.Replace(mainDirectoryPath, "");
//Read the file stream by its Full name
FileStream stream = new FileStream(file.FullName, FileMode.Open, FileAccess.ReadWrite);
FileAttributes attributes = File.GetAttributes(file.FullName);
//Add the item to the zip Archive
zipArchive.AddItem(fileName, stream, true, attributes);
}
}
}
//Unzipping the Folder
private static void UnZipFiles()
{
ZipArchive zip = new ZipArchive();
string path = @"..\..\UnZippedFile";
zip.Open(@"..\..\UnzippedFile.zip");
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
//Saving the contents of zip file to disk.
for (int i = 0; i < zip.Count; i++)
{
ZipArchiveItem item = zip[i];
string itemName = path + item.ItemName;
//checking whether the item is root file
if (itemName.Contains("/"))
{
itemName = itemName.Replace("/", "\\");
}
//Check whether the Directory is present or not
if (!Directory.Exists(itemName) || itemName.Contains("\\"))
{
int index = itemName.LastIndexOf("\\");
string directoryPath = itemName.Remove(index, itemName.Length - index);
Directory.CreateDirectory(directoryPath);
}
FileStream fileStream = new FileStream(itemName, FileMode.OpenOrCreate, FileAccess.ReadWrite);
MemoryStream memoryStream = item.DataStream as MemoryStream;
memoryStream.WriteTo(fileStream);
fileStream.Flush();
fileStream.Close();
}
Console.WriteLine("File has been Unzipped");
}
static void Main(string[] args)
{
ZipAndSave();
UnZipFiles();
}
}
{% endhighlight %}
{% highlight vb %}
Imports Syncfusion.Compression.Zip
Class Program
Private Shared arrOfItems As New List(Of DirectoryInfo)()
Private Shared zipArchive As New ZipArchive()
Private Shared folderPath As String = "..\..\ZipFiles"
Private Shared Sub SubFoldersFiles(path As String)
Dim dInfo As New DirectoryInfo(path)
For Each d As DirectoryInfo In dInfo.GetDirectories()
SubFoldersFiles(d.FullName)
arrOfItems.Add(d)
Next
End Sub
' Zip and save the file.
Private Shared Sub ZipAndSave()
SubFoldersFiles(folderPath)
If Directory.Exists(folderPath) Then
AddRootFiles()
AddSubFoldersFiles()
' Saving zipped file.
zipArchive.Save("..\..\UnzippedFile.zip")
zipArchive.Close()
Console.WriteLine("Files Zipped successfully!")
End If
End Sub
Private Shared Sub AddRootFiles()
Dim fileName As String = ""
For Each rootFiles As String In Directory.GetFiles(folderPath)
'Creating the stream from file
Dim stream As New FileStream(rootFiles, FileMode.Open, FileAccess.ReadWrite)
'Getting the File Name alone and ignoring the directory path
fileName = Path.GetFileName(rootFiles)
Dim attribute As FileAttributes = File.GetAttributes(rootFiles)
zipArchive.AddItem(fileName, stream, False, attribute)
Next
End Sub
Private Shared Sub AddSubFoldersFiles()
For Each dInfo As DirectoryInfo In arrOfItems
Dim fInfo As FileInfo() = dInfo.GetFiles()
Dim mainDirectoryPath As String = Path.GetFullPath(folderPath)
For Each file__1 As FileInfo In fInfo
'Get the File name with its current folder and ignoring the Main Directory
Dim fileName As String = file__1.FullName.Replace(mainDirectoryPath, "")
'Read the file stream by its Full name
Dim stream As New FileStream(file__1.FullName, FileMode.Open, FileAccess.ReadWrite)
Dim attributes As FileAttributes = File.GetAttributes(file__1.FullName)
'Add the item to the zip Archive
zipArchive.AddItem(fileName, stream, True, attributes)
Next
Next
End Sub
'Unzipping the Folder
Private Shared Sub UnZipFiles()
Dim zip As New ZipArchive()
Dim path As String = "..\..\UnZippedFile"
zip.Open("..\..\UnzippedFile.zip")
If Not Directory.Exists(path) Then
Directory.CreateDirectory(path)
End If
'Saving the contents of zip file to disk.
For i As Integer = 0 To zip.Count - 1
Dim item As ZipArchiveItem = zip(i)
Dim itemName As String = path + item.ItemName
'checking whether the item is root file
If itemName.Contains("/") Then
itemName = itemName.Replace("/", "\")
End If
'Check whether the Directory is present or not
If Not Directory.Exists(itemName) OrElse itemName.Contains("\") Then
Dim index As Integer = itemName.LastIndexOf("\")
Dim directoryPath As String = itemName.Remove(index, itemName.Length - index)
Directory.CreateDirectory(directoryPath)
End If
Dim fileStream As New FileStream(itemName, FileMode.OpenOrCreate, FileAccess.ReadWrite)
Dim memoryStream As MemoryStream = TryCast(item.DataStream, MemoryStream)
memoryStream.WriteTo(fileStream)
fileStream.Flush()
fileStream.Close()
Next
Console.WriteLine("File has been Unzipped")
End Sub
Private Shared Sub Main(args As String())
ZipAndSave()
UnZipFiles()
End Sub
End Class
{% endhighlight %}
{% endtabs %}
## See Also
* [How to zip files using the Syncfusion.Compression.Zip namespace?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-zip-files-using-the-syncfusion-compression-zip-namespace)
* [How to protect the zip files using Syncfusion.Compression.Base?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-protect-the-zip-files-using-syncfusion-compression-base)
* [How to un-protect the zip files using Syncfusion.Compression.Base?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-un-protect-the-zip-files-using-syncfusion-compression-base)
* [How to merge excel files from more than one workbook to a single file?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-merge-excel-files-from-more-than-one-workbook-to-a-single-file)

Просмотреть файл

@ -0,0 +1,122 @@
---
title: Zip files using the Syncfusion.Compression.Zip namespace | Syncfusion
description: This page demonstrates with an example on how to zip files using the Syncfusion.Compression.Zip namespace.
platform: File-formats
control: XlsIO
documentation: UG
---
# How to zip files using the Syncfusion.Compression.Zip namespace?
You can compress the file using Syncfusion.Compression.Zip namespace. The following code illustrate this.
{% tabs %}
{% highlight c# %}
using Syncfusion.Compression.Zip;
ZipArchive zipArchive = new Syncfusion.Compression.Zip.ZipArchive();
zipArchive.DefaultCompressionLevel = Syncfusion.Compression.CompressionLevel.Best;
//Add the file you want to zip.
zipArchive.AddFile("SampleFile.cs");
//Zip file name and location.
zipArchive.Save("SyncfusionCompressFileSample.zip");
zipArchive.Close();
{% endhighlight %}
{% highlight vb %}
Imports Syncfusion.Compression.Zip
Dim zipArchive As ZipArchive = New Syncfusion.Compression.Zip.ZipArchive()
zipArchive.DefaultCompressionLevel = Syncfusion.Compression.CompressionLevel.Best
'Add the file you want to zip.
zipArchive.AddFile("SampleFile.cs")
'Zip file name and location.
zipArchive.Save("SyncfusionCompressFileSample.zip")
zipArchive.Close()
{% endhighlight %}
{% endtabs %}
T>You can use CompressionLevel to reduce the size of the file.
For compressing directories, you can make use of the **AddDirectory** method which adds an empty directory file to a ZipArchive. If you want to add all the files inside the directory, then you should manually add these files by using the **AddItem** method.
The following code snippet illustrate how to add the file from the local drive.
{% tabs %}
{% highlight c# %}
string fileName = @"SampleFile.cs";
ZipArchive zipArchive = new Syncfusion.Compression.Zip.ZipArchive();
zipArchive.DefaultCompressionLevel =CompressionLevel.Best;
Stream stream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
FileAttributes attributes = File.GetAttributes(fileName);
ZipArchiveItem item = new ZipArchiveItem(zipArchive, "SampleFile.cs", stream, true, attributes);
zipArchive.AddItem(item);
zipArchive.Save(@"SyncfusionCompressFileSample.zip");
zipArchive.Close();
{% endhighlight %}
{% highlight vb %}
Dim fileName As String = "SampleFile.cs"
Dim zipArchive As ZipArchive = New Syncfusion.Compression.Zip.ZipArchive()
zipArchive.DefaultCompressionLevel = CompressionLevel.Best
Dim stream As Stream = New FileStream(fileName, FileMode.Open, FileAccess.Read)
Dim attributes As FileAttributes = File.GetAttributes(fileName)
Dim item As New ZipArchiveItem(zipArchive, "SampleFile.cs", stream, True, attributes)
zipArchive.AddItem(item)
zipArchive.Save("SyncfusionCompressFileSample.zip")
zipArchive.Close()
{% endhighlight %}
{% endtabs %}
## See Also
* [How to zip files using the Syncfusion.Compression.Zip namespace?](faqs/how-to-zip-files-using-the-syncfusion-compression-zip-namespace)
* [How to protect the zip files using Syncfusion.Compression.Base?](faqs/how-to-protect-the-zip-files-using-syncfusion-compression-base)
* [How to un-protect the zip files using Syncfusion.Compression.Base?](faqs/how-to-un-protect-the-zip-files-using-syncfusion-compression-base)
* [How to merge excel files from more than one workbook to a single file?](faqs/how-to-merge-excel-files-from-more-than-one-workbook-to-a-single-file)

Просмотреть файл

@ -0,0 +1,23 @@
---
title: Using AutoDetectComplexScript converter property | XlsIO | Syncfusion
description: This page explains the situation in which the AutoDetectComplexScript converter property in XlsIO can be used.
platform: File-formats
control: XlsIO
documentation: UG
---
# In which situation we use AutoDetectComplexScript converter property?
Complex script languages are some languages (eg., Arabic) which stores text differently from how it is displayed. Many such languages use bidirectional script which means, words and sentences are written from right to left, while some text such as numbers and Roman-based words are written from left to right.
If your input Excel file contains such complex script languages, then the AutoDetectComplexScript property can be used to render them in PDF.
## See Also
* [How to auto-detect complex script?](https://help.syncfusion.com/file-formats/xlsio/excel-to-pdf-converter-settings#auto-detect-complex-script)
* [How to use substitute font in Excel to PDF conversion?](https://help.syncfusion.com/file-formats/xlsio/excel-to-pdf-conversion#substitute-font-in-excel-to-pdf-conversion)
* [How to Embed Fonts?](https://help.syncfusion.com/file-formats/xlsio/excel-to-pdf-converter-settings#embed-fonts)
* [How to capture warnings in Excel to PDF conversion?](https://help.syncfusion.com/file-formats/xlsio/excel-to-pdf-converter-settings#capture-warnings-in-excel-to-pdf-conversion)
* [What is the image quality when using the ExportQualityImage property?](https://help.syncfusion.com/file-formats/xlsio/faqs/what-is-the-image-quality-when-using-the-exportqualityimage-property)

Просмотреть файл

@ -0,0 +1,11 @@
---
title: Maximum characters count in an Excel cell | XlsIO | Syncfusion
description: This page has information of maximum characters count in an Excel cell in Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# Information about maximum characters count in an Excel cell
An Excel cell accepts only maximum 32767 characters. ArgumentOutOfRangeException is thrown when you try to set the text with length greater that 32767 characters, into an Excel cell. This is the behavior of Microsoft Excel and Syncfusion XlsIO also does the same. Please go through [Excel Specifications and Limits](https://support.microsoft.com/en-us/office/excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3).

Просмотреть файл

@ -0,0 +1,11 @@
---
title: How to overcome Parameter Not valid exception | XlsIO | Syncfusion
description: This page tells the reason for parameter not valid exception in Excel to PDF with Custom Papar Size in Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# How to overcome Parameter Not valid exception?
ParameterNotValid exception occurs while trying to convert Excel document to PDF with large CustomPaperSize. Syncfusion XlsIO cannot handle such large values. Also, the values are considered in inches. Using height and width below 200 would resolve the issue.

Просмотреть файл

@ -0,0 +1,25 @@
---
title: Image quality when using the ExportQualityImage property | Syncfusion
description: This page explains about the impact on image quality when using the ExportQualityImage property of XlsIO.
platform: File-formats
control: XlsIO
documentation: UG
---
# What is the image quality when using the ExportQualityImage property?
Normally, the image in the PDF will be saved in PNG format. With this property, the TIFF format is used for exporting the images into PDF.
**TIFF (non-default):**
TIFF uses a lossless compression algorithm in order to preserve as much quality in the image. They are high resolution files with larger sizes. They are no longer supported on many websites, due to their slower loading time. If you can still open the file, it will take much longer to download or load in the browser due to their size. Since they preserve the most quality, they are best used for printing to paper and even billboard signs.
**PNG (default):**
PNG is ideal even for complex images. If you require more detail in graphics, then PNG is better. PNG provides the best support for transparency. PNG is ideal for static images, logos, prints and other images with transparent background.
Hence, we have used PNG format as default for exporting the images into PDF. If you are concerned only about the image quality and not about file size and loading time, then you can use the non-default with the **ExportQualityImage** property.
## See Also
* [How to export quality image?](https://help.syncfusion.com/file-formats/xlsio/excel-to-pdf-converter-settings#export-quality-image)
* [How to convert Worksheet to Image?](https://help.syncfusion.com/file-formats/xlsio/worksheet-to-image-conversion)
* [How to convert Chart to Image?](https://help.syncfusion.com/file-formats/xlsio/chart-to-image-conversion)

Просмотреть файл

@ -0,0 +1,23 @@
---
title: What is the maximum range of Rows and Columns | Syncfusion
description: This page tells about the maximum range of rows and columns supported in Syncfusion .NET Excel library (XlsIO).
platform: File-formats
control: XlsIO
documentation: UG
---
# What is the maximum range of Rows and Columns?
XlsIO has support below worksheet size for Excel 97 to 2003, Excel 2007 and later versions.
* **Excel** **97** **to** **2003****(.****xls** **format****)** – 65,536 by 256 rows and columns.
* **Excel** **2007** **and** **Later** **versions****(.****xlsx** **format****)** – 1,048,576 by 16,384 rows and columns
The above specification is the worksheet size of Excel. For more information, see [Excel specifications and limits](https://support.office.com/en-nz/article/Excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3)
## See Also
* [How to unfreeze the rows and columns in XlsIO?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-unfreeze-the-rows-and-columns-in-xlsio)
* [How to hide the summary rows and columns using XlsIO?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-hide-the-summary-rows-and-columns-using-xlsio)
* [How to sort two or more columns in a pivot table?](https://help.syncfusion.com/file-formats/xlsio/faqs/how-to-sort-two-or-more-columns-in-a-pivot-table)
* [How to manipulate worksheet rows and columns?](https://help.syncfusion.com/file-formats/xlsio/worksheet-rows-and-columns-manipulation)

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 55 KiB

После

Ширина:  |  Высота:  |  Размер: 52 KiB

Просмотреть файл

@ -74,7 +74,7 @@ Essential Presentation
## Quick Start links:
[Create a PDF file in C# without Adobe](https://help.syncfusion.com/file-formats/pdf/getting-started)
[Create a PDF file in C# without Adobe](https://help.syncfusion.com/file-formats/pdf/create-pdf-file-in-c-sharp-vb-net)
[Create Excel file in C# without Microsoft Office](https://help.syncfusion.com/file-formats/xlsio/getting-started)
[Create Word file in C# without Microsoft Office](https://help.syncfusion.com/file-formats/docio/getting-started)
[Create PowerPoint file in C# without Microsoft Office](https://help.syncfusion.com/file-formats/presentation/getting-started)