<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Spire.Office &#8211; Sibeesh Passion</title>
	<atom:link href="https://www.sibeeshpassion.com/tag/spire-office/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.sibeeshpassion.com</link>
	<description>My passion towards life</description>
	<lastBuildDate>Wed, 02 Jun 2021 15:16:32 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>/wp-content/uploads/2017/04/Sibeesh_Passion_Logo_Small.png</url>
	<title>Spire.Office &#8211; Sibeesh Passion</title>
	<link>https://www.sibeeshpassion.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Using Spire.XLS</title>
		<link>https://www.sibeeshpassion.com/using-spire-xls/</link>
					<comments>https://www.sibeeshpassion.com/using-spire-xls/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Sun, 12 Jul 2015 08:34:08 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[Spire.XLS]]></category>
		<category><![CDATA[Convert Excel to PDF]]></category>
		<category><![CDATA[Convert Excel to PDF in C#]]></category>
		<category><![CDATA[Convert Excel to PDF in CSharp]]></category>
		<category><![CDATA[Excel to HTML]]></category>
		<category><![CDATA[Spire.Office]]></category>
		<category><![CDATA[Spire.XLs]]></category>
		<category><![CDATA[Using Spire.XLS]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=6731</guid>

					<description><![CDATA[[toc] Introduction Hi I hope you all are fine. Today we are going to see a new product Spire.XLS which helps us to create, manipulate, convert EXCEL file to other formats and many more. This product has been introduced by the company E-Iceblue. I hope you have read my article of Spire.Doc. If you have not read it, I recommend you to read it here: Using Spire.Doc Download source code Using Spire XLS With Visual Studio Background Always, managing excel files through code is a tough job for me. If you are also thinking the same, I h3ly recommend this [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>[toc]</p>
<h3>Introduction</h3>
<p>Hi I hope you all are fine. Today we are going to see a new product <em>Spire.XLS</em> which helps us to create, manipulate, convert EXCEL file to other formats and many more. This product has been introduced by the company <a href="http://www.e-iceblue.com/" target="_blank" rel="noopener">E-Iceblue</a>. I hope you have read my article of <em>Spire.Doc</em>. If you have not read it, I recommend you to read it here: <a href="http://sibeeshpassion.com/using-spire-doc-introduction/" target="_blank" rel="noopener">Using Spire.Doc</a></p>
<h3>Download source code </h3>
<li><a href="https://code.msdn.microsoft.com/Using-SpireXLS-With-Visual-00c1d812" target="_blank" rel="noopener">Using Spire XLS With Visual Studio</a></li>
<h3>Background</h3>
<p>Always, managing excel files through code is a tough job for me. If you are also thinking the same, I h3ly recommend this product Spire.XLX from E-Iceblue. It made the task easier than ever. In this article I will show you the demo for converting the Excel files to other formats. I hope you will like it.</p>
<h3>Download the files</h3>
<p>You can always the needed files from here: <a href="http://www.e-iceblue.com/Download/download-excel-for-net-now.html" target="_blank" rel="noopener">Download Spire.XLS</a></p>
<h3>Install Spire.XLS</h3>
<p>I am using evaluation version with one month temporary license. There are free versions also available for spire.xls with some limitation. You can try that. Now click on the exe file after you extract the downloaded file. The installation will get started then.</p>
<p><img fetchpriority="high" decoding="async" src="http://sibeeshpassion.com/content/images/InstallSpireXls.png" width="513" height="405" class="alignnone size-full" /></p>
<p>So Shall we start?</p>
<p>Once you Installed, you are ready to go. We will start with a “Simple Windows Form ” Application. Before getting started, Please install Spire.XLs and Visual studio 2008 or above. I am using Visual Studio 2015 RC. I hope everything set ?</p>
<p>Open your Visual Studio, click on New->Project->Select Visual C# (if you are good in C# or select Visual Basic) Project->Windows->Windows forms application->Name your project(I am naming it as Using SpireXLs)</p>
<p><img decoding="async" src="http://sibeeshpassion.com/content/images/UsingSpireXLS1.png" alt="Using Spire XLS" /></p>
<p>Now create a group box and a button in your form and name them :). Later, click on the button. </p>
<p><img decoding="async" src="http://sibeeshpassion.com/content/images/UsingSpireXLS2.png" alt="Using Spire XLS" /></p>
<p>Now right click on your project and click add reference, in the browse tab find out the folder in which you have installed spire xls. Usually it will be in the C:\Program Files\e-iceblue\Spire.Xls. Now just find your framework version from BIN folder and add Spire.xls.dll</p>
<p><img decoding="async" src="http://sibeeshpassion.com/content/images/UsingSpireXLS3.png" alt="Using Spire XLS" /></p>
<p><img decoding="async" src="http://sibeeshpassion.com/content/images/AddingSpireXLSReference.png" alt="Using Spire XLS" /></p>
<p>Now we have added reference too. So shall we start coding ?</p>
<h3>Using the code</h3>
<p>To start with coding you need to add the needed namespaces as follows.</p>
<p>[csharp]<br />
using Spire.Xls;<br />
using Spire.Pdf;<br />
using Spire.Xls.Converter;<br />
[/csharp]</p>
<p>In the button click event you need to add the following lines codes.</p>
<h4>C# Code</h4>
<p>[csharp]<br />
private void button1_Click(object sender, EventArgs e)<br />
        {<br />
             // load Excel file<br />
           Workbook workbook = new Workbook();<br />
           workbook.LoadFromFile(&quot;D:\\MyExcel.xlsx&quot;);<br />
           // Set PDF template<br />
           PdfDocument pdfDocument = new PdfDocument();<br />
           pdfDocument.PageSettings.Orientation = PdfPageOrientation.Landscape;<br />
           pdfDocument.PageSettings.Width = 970;<br />
           pdfDocument.PageSettings.Height = 850;<br />
           //Convert Excel to PDF using the template above<br />
           PdfConverter pdfConverter = new PdfConverter(workbook);<br />
           PdfConverterSettings settings = new PdfConverterSettings();<br />
           settings.TemplateDocument = pdfDocument;<br />
           pdfDocument = pdfConverter.Convert(settings);<br />
           // Save and preview PDF<br />
           pdfDocument.SaveToFile(&quot;MyPDF.pdf&quot;);<br />
           System.Diagnostics.Process.Start(&quot;MyPDF.pdf&quot;);</p>
<p>        }<br />
[/csharp]</p>
<h4>VB.NET Code</h4>
<p>[csharp]<br />
&#8216;load Excel file<br />
            Dim workbook As New Workbook()<br />
            workbook.LoadFromFile(&quot;D:\MyExcel.xlsx&quot;)<br />
            &#8216; Set PDF template<br />
            Dim pdfDocument As New PdfDocument()<br />
            pdfDocument.PageSettings.Orientation = PdfPageOrientation.Landscape<br />
            pdfDocument.PageSettings.Width = 970<br />
            pdfDocument.PageSettings.Height = 850<br />
            &#8216;Convert Excel to PDF using the template above<br />
            Dim pdfConverter As New PdfConverter(workbook)<br />
            Dim settings As New PdfConverterSettings()<br />
            settings.TemplateDocument = pdfDocument<br />
            pdfDocument = pdfConverter.Convert(settings)<br />
            &#8216; Save and preview PDF<br />
            pdfDocument.SaveToFile(&quot;MyPdf.pdf&quot;)<br />
            System.Diagnostics.Process.Start(&quot;MyPdf.pdf&quot;)<br />
[/csharp]</p>
<p>In the above lines code, we are loading an excel file MyExcel.xlsx from my drive. The following is the content of our excel file.</p>
<p><img decoding="async" src="http://sibeeshpassion.com/content/images/SpireXLSSampleExcelFile.png" alt="Using Spire XLS" /></p>
<p>Now if you run your project and click our button, you will get a pdf file as follows.</p>
<p><img decoding="async" src="http://sibeeshpassion.com/content/images/SpireXLSPDFConvertOutput.png" alt="Using Spire XLS" /></p>
<p>Cool!. Very simple right? Now we will go to other conversions as well.</p>
<h3>Excel to HTML</h3>
<p>To convert our excel file to HTML, you need to create a button in our form and paste the following codes to the button click event.</p>
<h4>C# Code</h4>
<p>[csharp]<br />
private void button2_Click(object sender, EventArgs e)<br />
        {<br />
            //load Excel file<br />
            Workbook workbook = new Workbook();<br />
            workbook.LoadFromFile(&quot;D:\\MyExcel.xlsx&quot;);<br />
            //convert Excel to HTML<br />
            Worksheet sheet = workbook.Worksheets[0];<br />
            sheet.SaveToHtml(&quot;MyHTML.html&quot;);<br />
            //Preview HTML<br />
            System.Diagnostics.Process.Start(&quot;MyHTML.html&quot;);</p>
<p>        }<br />
[/csharp]</p>
<h4>VB.NET Code</h4>
<p>[csharp]<br />
 Private Shared Sub Main(args As String())<br />
            &#8216;load Excel file<br />
            Dim workbook As New Workbook()<br />
            workbook.LoadFromFile(&quot;D:\\MyExcel.xlsx&quot;)<br />
            &#8216;convert Excel to HTML<br />
            Dim sheet As Worksheet = workbook.Worksheets(0)<br />
            sheet.SaveToHtml(&quot;MyHTML.html&quot;)<br />
            &#8216;Preview HTML<br />
            System.Diagnostics.Process.Start(&quot;MyHTML.html&quot;)<br />
        End Sub<br />
[/csharp]</p>
<p>Now if you run the code, you can see an html file as follows.</p>
<p><img decoding="async" src="http://sibeeshpassion.com/content/images/SpireXLsConvertHTMLPutput.png" alt="Using Spire XLS" /></p>
<h3>Excel To Image</h3>
<p>To convert our excel file to image, you need to create a button in our form and paste the following codes to the button click event.</p>
<h4>C# Code</h4>
<p>[csharp]<br />
private void button3_Click(object sender, EventArgs e)<br />
        {<br />
            Workbook workbook = new Workbook();<br />
            workbook.LoadFromFile(&quot;D:\\MyExcel.xlsx&quot;);<br />
            Worksheet sheet = workbook.Worksheets[0];<br />
            sheet.SaveToImage(&quot;MyImage.jpg&quot;);</p>
<p>        }<br />
[/csharp]</p>
<h4>VB.NET Code</h4>
<p>[csharp]<br />
  Shared Sub Main(ByVal args() As String)<br />
                     Dim workbook As New Workbook()<br />
                     workbook.LoadFromFile(&quot;D:\\MyExcel.xlsx&quot;)<br />
                     Dim sheet As Worksheet = workbook.Worksheets(0)<br />
                     sheet.SaveToImage(&quot;MyImage.jpg&quot;)<br />
  End Sub<br />
[/csharp]</p>
<p>Now if you run the code, you can see an Image as follows.</p>
<p><img decoding="async" src="http://sibeeshpassion.com/content/images/SpireXLSConvertExcelToImagesOutput1.png" alt="Using Spire XLS"/></p>
<p><img decoding="async" src="http://sibeeshpassion.com/content/images/SpireXLSConvertExcelToImagesOutput2.png" alt="Using Spire XLS"/></p>
<h3>Excel to CSV</h3>
<p>To convert our excel file to image, you need to create a button in our form and paste the following codes to the button click event.</p>
<h4>C# Code</h4>
<p>[csharp]<br />
private void button3_Click(object sender, EventArgs e)<br />
        {<br />
            Workbook workbook = new Workbook();<br />
            workbook.LoadFromFile(&quot;D:\\MyExcel.xlsx&quot;);<br />
            Worksheet sheet = workbook.Worksheets[0];<br />
            sheet.SaveToFile(&quot;MyCSV.csv&quot;, &quot;,&quot;, Encoding.UTF8);</p>
<p>        }<br />
[/csharp]</p>
<h4>VB.NET Code</h4>
<p>[csharp]<br />
  Shared Sub Main(ByVal args() As String)<br />
                     Dim workbook As New Workbook()<br />
                     workbook.LoadFromFile(&quot;D:\\MyExcel.xlsx&quot;)<br />
                     Dim sheet As Worksheet = workbook.Worksheets(0)<br />
                     sheet.SaveToFile(&quot;MyCSV.csv&quot;, &quot;,&quot;, Encoding.UTF8)</p>
<p>  End Sub<br />
[/csharp]</p>
<p>Now if you run the code, you can see a CSV file as follows.</p>
<p><img decoding="async" src="http://sibeeshpassion.com/content/images/SpireXLSConvertExcelToCSVOutput.png" alt="Using Spire XLS"/></p>
<p><em>Please be noted that, you can convert your excel to any other file format, there are plenty of options available. Please try that too. I have given only three options which I use always.</em></p>
<h3>Conclusion</h3>
<p>Did I miss anything that you may think which is needed? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<h3>Your turn. What do you think?</h3>
<p>A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sibeeshpassion.com/using-spire-xls/feed/</wfw:commentRss>
			<slash:comments>9</slash:comments>
		
		
			</item>
	</channel>
</rss>
