C# Save Excel Worksheet As Pdf
var q c23saveexcelworksheetaspdfConvert Excel file using Spire. XLSIntroduction. Hi. I hope you all are fine. Today we will see a new product Spire. XLS that helps us to create, manipulate and convert Excel files 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. Read Write Excel files in C sample source codes Read from Excel File. PDF files that contain the Visual Studio 2005 documentation. Doc. If you have not read it, I recommend you read it at Using Spire. Doc. Download source code. Using Spire XLS With Visual Studio. Background. Always, managing Excel files using code is a tough job for me. If you agree then I strongly recommend the product Spire. XLX from E Iceblue. It made the task easier than ever. This article provides a demo of converting Excel files to other formats. I hope you like it. Download the files. You can always get the necessary files from Download Spire. XLS. Install Spire. XLSI am using evaluation version with one month temporary license. There are free versions also available for spire. You can try that. Now click on the exe file after you extract the downloaded file. The installation will then start. Here Mudassar Ahmed Khan has explained with an example, how to read and import Excel file Excel sheet data to GridView using ClosedXml library in ASP. Net using C. NPOI is a great solution for working with XLS documents, but what happens when you need to read in XLSX documents as part of your solution The easiest solution I. Here is my advise Taken from the KB you posted. Method 1 Contents of the spreadsheet. Can you create and save a blank excel workbook If so maybe there is. This article shows how to import data to Excel, insert a chart and convert Excel to PDF via two free libraries that dont require that Microsoft Excel be installed in. Heres an example that shows how to Export data to an Excel file all excel versions using Asp. Net C and VB. Net and Microsoft. Office. Interop. Using Dependent Form Control Combo Boxes and Validation Cells with Named Ranges for Cross Platform Excel Development Using Dependent Form Control Combo Boxes and. So shall we start Once you have installed it, you are ready to go. We will start with a Simple Windows Forms application. Before starting, please install Spire. XLs and Visual Studio 2. I am using Visual Studio 2. RC. I hope everything is set. Open your Visual Studio, click on File New Project. then select Visual C if you are good in C or select Visual Basic then in the Project seelct Windows Windows Forms Application then name your project I am naming it Using Spire. XLs. Now create a group box and a button in your form and name them. Later, click on the button. Now right click on your project and click Add reference. Then in the browse tab determine the folder in which you have installed Spire xls. Usually it will be in the C Program Filese iceblueSpire. Xls. Now just find your framework version from the BIN folder and add Spire. DLL. Now we have added the reference too. So shall we start coding Using the code. To start with the coding you need to add the necessary namespaces as follows. Spire. Xls using Spire. Pdf using Spire. Xls. Converter In the button click event you need to add the following code. C Code private void button. Clickobject sender, Event. Args e Workbook workbook new Workbook workbook. Load. From. FileD My. Excel. xlsx Pdf. Document pdf. Document new Pdf. Document pdf. Document. Page. Settings. Orientation Pdf. Page. Orientation. Landscape pdf. Document. Page. Settings. Width 9. 70 pdf. Document. Page. Settings. Height 8. 50 Pdf. Converter pdf. Converter new Pdf. Converterworkbook Pdf. Converter. Settings settings new Pdf. Converter. Settings settings. Template. Document pdf. Document pdf. Document pdf. Converter. Convertsettings pdf. Document. Save. To. FileMy. PDF. pdf System. Diagnostics. Process. StartMy. PDF. pdf VB. NET Codeload Excel file Dim workbook As New Workbook workbook. Load. From. FileD My. Excel. xlsx Set PDF template Dim pdf. Document As New Pdf. Document pdf. Document. Page. Settings. Orientation Pdf. Page. Orientation. Landscape pdf. Document. Page. Settings. Width 9. Document. Page. Settings. Height 8. 50 Convert Excel to PDF using the template above Dim pdf. Converter As New Pdf. Converterworkbook Dim settings As New Pdf. Converter. Settings settings. Template. Document pdf. Document pdf. Document pdf. Converter. Convertsettings Save and preview PDF pdf. Document. Save. To. FileMy. Pdf. pdf System. Diagnostics. Process. StartMy. Pdf. pdf In the preceding code, we are loading an Excel file My. Excel. xlsx from my drive. The following is the contents of the Excel file. Now if you run your project and click our button, you will get a PDF file as follows. Cool Very simple, right Now we will go to other conversions as well. Excel to HTMLTo convert our Excel file to HTML, you need to create a button in our form and paste the following code to the button click event. C Code private void button. Clickobject sender, Event. Args e Workbook workbook new Workbook workbook. Load. From. FileD My. Excel. xlsx Worksheet sheet workbook. Worksheets0 sheet. Save. To. HtmlMy. HTML. html System. Diagnostics. Process. StartMy. HTML. html VB. NET Code. Private Shared Sub Mainargs As String load Excel file Dim workbook As New Workbook workbook. Load. From. FileD My. Excel. xlsx convert Excel to HTML Dim sheet As Worksheet workbook. Worksheets0 sheet. Save. To. HtmlMy. HTML. html Preview HTML System. Diagnostics. Process. StartMy. HTML. html End Sub Now if you run the code, you can see an HTML file as follows. Excel To Image. To convert our Excel file to an image, you need to create a button in our form and paste the following code to the button click event. C Codeprivate void button. Clickobject sender, Event. Args e Workbook workbook new Workbook workbook. Load. From. FileD My. Excel. xlsx Worksheet sheet workbook. Worksheets0 sheet. Save. To. ImageMy. Image. jpg VB. NET Code Shared Sub MainBy. Val args As String Dim workbook As New Workbook workbook. Load. From. FileD My. Excel. xlsx Dim sheet As Worksheet workbook. Worksheets0 sheet. Save. To. ImageMy. Image. jpg End Sub Now if you run the code, you can see an image as follows. Excel to CSVTo convert our Excel file to an image, you need to create a button in our form and paste the following code to the button click event. C Code private void button. Clickobject sender, Event. Args e Workbook workbook new Workbook workbook. Load. From. FileD My. Excel. xlsx Worksheet sheet workbook. Worksheets0 sheet. Save. To. FileMy. CSV. csv, , Encoding. UTF8 VB. NET Code. Shared Sub MainBy. Val args As String Dim workbook As New Workbook workbook. Load. From. FileD My. Excel. xlsx Dim sheet As Worksheet workbook. Worksheets0 sheet. Save. To. FileMy. CSV. csv, , Encoding. UTF8 End Sub Now if you run the code, you can see a CSV file as follows. lt em Please note that you can convert your Excel data to any other file format, there are plenty of options available. Please try that too. I have given only three options that I use always. Conclusion. 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. Your turn. What do you think A blog isnt a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, youre 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 Ill definitely try to help if I can.