Skip to content

Commit 919d46a

Browse files
authored
Merge pull request #2322 from syncfusion-content/1009870-FileExtensionFAQ
Documentation(1009870): FAQ for how to get the file extension of excel file using XlsIO
2 parents 94bdd9b + 4f426e9 commit 919d46a

2 files changed

Lines changed: 55 additions & 0 deletions

File tree

Document-Processing-toc.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6470,6 +6470,9 @@
64706470
<li>
64716471
<a href="/document-processing/excel/excel-library/net/faqs/how-to-clear-formats-in-worksheet">How to clear formats in a worksheet using XlsIO?</a>
64726472
</li>
6473+
<li>
6474+
<a href="/document-processing/excel/excel-library/net/faqs/how-to-get-the-file-extension-of-excel-file">How to get the file extension of an Excel file using XlsIO?</a>
6475+
</li>
64736476
</ul>
64746477
</li>
64756478
</ul>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
title: How to get file extension of an Excel file | XlsIO | Syncfusion
3+
description: This page explains how to get the file extension of an Excel file using the Syncfusion .NET Excel library (XlsIO).
4+
platform: document-processing
5+
control: XlsIO
6+
documentation: UG
7+
---
8+
9+
# How to get the file extension of an Excel file using XlsIO?
10+
11+
When an Excel file is opened with XlsIO, you can obtain its full path and extension from the [WorkbookImpl.FullFileName](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.Implementation.WorkbookImpl.html#Syncfusion_XlsIO_Implementation_WorkbookImpl_FullFileName) property. The following code snippet illustrates this.
12+
13+
{% tabs %}
14+
{% highlight c# tabtitle="C# [Cross-platform]" %}
15+
using (ExcelEngine excelEngine = new ExcelEngine())
16+
{
17+
IApplication application = excelEngine.Excel;
18+
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
19+
20+
string fileName = (workbook as WorkbookImpl).FullFileName;
21+
22+
// Display file extension of excel file
23+
Console.WriteLine(Path.GetExtension(fileName));
24+
}
25+
{% endhighlight %}
26+
27+
{% highlight c# tabtitle="C# [Windows-specific]" %}
28+
using (ExcelEngine excelEngine = new ExcelEngine())
29+
{
30+
IApplication application = excelEngine.Excel;
31+
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
32+
33+
string fileName = (workbook as WorkbookImpl).FullFileName;
34+
35+
// Display file extension of excel file
36+
Console.WriteLine(Path.GetExtension(fileName));
37+
}
38+
{% endhighlight %}
39+
40+
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
41+
Using excelEngine As New ExcelEngine()
42+
Dim application As IApplication = excelEngine.Excel
43+
Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xlsx")
44+
45+
Dim fileName As String = CType(workbook, WorkbookImpl).FullFileName
46+
47+
' Display file extension of excel file
48+
Console.WriteLine(Path.GetExtension(fileName))
49+
End Using
50+
{% endhighlight %}
51+
{% endtabs %}
52+

0 commit comments

Comments
 (0)