Skip to content

Commit 0bdb1ed

Browse files
authored
Merge pull request #1912 from syncfusion-content/989214-EnableFileNameWithExtension
989214-Update details about EnableFileNameWithExtension property in ExcelToPdfConverterSettings page in UG
2 parents f358ac0 + 87d66c9 commit 0bdb1ed

File tree

1 file changed

+84
-1
lines changed

1 file changed

+84
-1
lines changed

Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Excel-to-PDF-Converter-Settings.md

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2234,4 +2234,87 @@ End Namespace
22342234
{% endhighlight %}
22352235
{% endtabs %}
22362236

2237-
A complete working example to skip warning in Excel to PDF in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Excel%20to%20PDF/Warnings/.NET/Warnings).
2237+
A complete working example to skip warning in Excel to PDF in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Excel%20to%20PDF/Warnings/.NET/Warnings).
2238+
2239+
## Show File Name
2240+
2241+
This property allows you to display the file name along with its extension in the header and/or footer when converting an Excel document to PDF. It's default value is FALSE.
2242+
2243+
The following code snippet explains how to enable the <a href="https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_ShowFileNameWithExtension">ShowFileNameWithExtension</a> property during Excel to PDF conversion.
2244+
2245+
{% tabs %}
2246+
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/XlsIO-Examples/master/Excel%20to%20PDF/Show%20file%20name%20with%20extension%20in%20PDF/.NET/ShowFileNameWithExtension/ShowFileNameWithExtension/Program.cs,180" %}
2247+
using (ExcelEngine excelEngine = new ExcelEngine())
2248+
{
2249+
IApplication application = excelEngine.Excel;
2250+
application.DefaultVersion = ExcelVersion.Xlsx;
2251+
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"));
2252+
2253+
//Initialize XlsIORendererSettings
2254+
XlsIORendererSettings settings = new XlsIORendererSettings();
2255+
2256+
//Enable ShowFileNameWithExtension property
2257+
settings.ShowFileNameWithExtension = true;
2258+
2259+
//Initialize XlsIORenderer
2260+
XlsIORenderer renderer = new XlsIORenderer();
2261+
2262+
//Convert the Excel document to PDF with renderer settings
2263+
PdfDocument pdfDocument = renderer.ConvertToPDF(workbook, settings);
2264+
2265+
#region Save
2266+
//Save the PDF document
2267+
pdfDocument.Save(Path.GetFullPath(@"Output/Output.pdf"));
2268+
#endregion
2269+
}
2270+
{% endhighlight %}
2271+
2272+
{% highlight c# tabtitle="C# [Windows-specific]" %}
2273+
using (ExcelEngine excelEngine = new ExcelEngine())
2274+
{
2275+
IApplication application = excelEngine.Excel;
2276+
application.DefaultVersion = ExcelVersion.Xlsx;
2277+
IWorkbook workbook = application.Workbooks.Open("InputTemplate.xlsx");
2278+
2279+
//Initialize ExcelToPdfConverterSettings
2280+
ExcelToPdfConverterSettings settings = new ExcelToPdfConverterSettings();
2281+
2282+
//Enable ShowFileNameWithExtension property
2283+
settings.ShowFileNameWithExtension = true;
2284+
2285+
//Load the Excel document into ExcelToPdfConverter
2286+
ExcelToPdfConverter converter = new ExcelToPdfConverter(workbook);
2287+
2288+
//Convert the Excel document to PDF with converter settings
2289+
PdfDocument document = converter.Convert(settings);
2290+
2291+
//Save the PDF document
2292+
document.Save("Output.pdf");
2293+
}
2294+
{% endhighlight %}
2295+
2296+
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
2297+
Using excelEngine As ExcelEngine = New ExcelEngine()
2298+
Dim application As IApplication = excelEngine.Excel
2299+
application.DefaultVersion = ExcelVersion.Xlsx
2300+
Dim workbook As IWorkbook = application.Workbooks.Open("InputTemplate.xlsx")
2301+
2302+
'Initialize ExcelToPdfConverterSettings
2303+
Dim settings As ExcelToPdfConverterSettings = New ExcelToPdfConverterSettings()
2304+
2305+
'Enable ShowFileNameWithExtension property
2306+
settings.ShowFileNameWithExtension = True
2307+
2308+
'Load the Excel document into ExcelToPdfConverter
2309+
Dim converter As ExcelToPdfConverter = New ExcelToPdfConverter(workbook)
2310+
2311+
'Convert the Excel document to PDF with converter settings
2312+
Dim document As PdfDocument = converter.Convert(settings)
2313+
2314+
'Save the PDF document
2315+
document.Save("Output.pdf")
2316+
End Using
2317+
{% endhighlight %}
2318+
{% endtabs%}
2319+
2320+
A complete working example demonstrating how to enable the <a href="https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_ShowFileNameWithExtension">ShowFileNameWithExtension</a> property during Excel to PDF conversion in C# is present on <a href="https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Excel%20to%20PDF/Show%20file%20name%20with%20extension%20in%20PDF/.NET/ShowFileNameWithExtension">this GitHub page</a>.

0 commit comments

Comments
 (0)