Making a pdf copy of a csv file programmatically in C# - c#

I have a csv file and I need to make a pdf copy in the console application that creates the csv. All I have found 3rd party libraries for working with pdf but I don't want to use that. Can I just make a copy and save it as a pdf? If so, how?
Also, I'm using C#, in case you didn't read the title.

Try the below link hope it will help you.
http://sourceforge.net/project/platformdownload.php?group_id=72954

You can open the csv with excel.
than use office PIA (interop) to save as PDF.
see:
Can I use Microsoft Office 2010: Primary Interop Assemblies to convert word,excel to PDF

first read the csv files using c# code, and load that data's into DataTable,
write the datatable values into pdf file using c#
may this idea will help 4 u

Related

Save as pdf using ClosedXML

Does ClosedXML have any function that can be used to save an excel file as PDF?
Currently i am using ClosedXML to create and populate the excel file and then using Interop to save as PDF.
But since Interop depends on the MS Office installed on the syatem the formatting changes on every version of MS Office. And since ClosedXML doesnt require having MS office installed it would be nice to be able to export or save as PDF directly from it without using Interops.
Does ClosedXML have any function that can be used to save an excel file as PDF?
No.
Instead you can use the free version of GemBox.Spreadsheet.
Also look at the top 10 libraries which allows us to manipulate excel.
However GemBox was the only free and featured one that I found with the purpose of creating an invoice report for a website, by converting excel to pdf.
you can use the ClosedXML.Excel and iTextSharp to convert Excel to PDF file.
Here a link with example:
Convert Excel file to Pdf in ASP.Net

OPEN XML to Export 2007/2010

In my application I already have functionality to export into 2003 format. Where I am constructing a string out of the template and write using System.IO.File.WriteAllText.
But it does not work with excel 2007/2010, that's why I wanted to convert it to Openxml in order to support 2007 and 2010.
I have string ready with creation of cells and rows from template.
I want advice on how to achieve or any body has reference link.
Please let me know.
Regards
WriteAllText class will save you a text file. You are saving an html(text) based file with xls extension. This is not a real xls file (that is actually a binary file), but MS Excel recognize and interpret the html format.
An xlsx file is a binary file. You can use OpenXML Office library ( Excel.XlFileFormat.xlOpenXMLWorkbook ) or another .NET Excel library like EasyXLS. Check this sample of code for more details.

Exporting to Excel without MS office installed for Wpf Product

I have a small wpf product which requires exporting data to excel with out excel installed on the client machine.How to achieve this in C#.After exporting, this excel can be opened by Open office. All I wanted is to save excel file to the client hard disk. Even excel is not installed he should be able to save the file,he may not be read it without excel but should be able to save. I dont want to any 3rd party or some other open xmls.
Recently I downloaded a product which is able to export to excel without excel installed and able to open it with open office.
When i checked their binaries they contain office.dll ,Microsoft.Vbe.Interop.dll and Microsoft.Office.Interop.Excel.dll's only .I want to know how they are able to manage with these dlls.
I have already written code for this but its breaking when excel is not installed.
I have read many open xml and other stuff relating to this but not satisfied.
My requirement is too simple ,just exporting datatable data to excel,no reading back the data and no fancy oparations with excel.
Please give me suggestions and links will be appreciated.
Thanks in advance
Either work out with CSV format or you may like to use EPPlus library. See similar answer here
You can use CSV, XML, or ADO
How To Use ADO.NET to Retrieve and Modify Records in an Excel Workbook With Visual Basic .NET
xslt transformation can also to the job. i use it to export wpf datagrid data.

Creating Excel File

Well, I didn't find any libs to create Excel file in Windows Phone 7 and the default libs for Excel are not working because they weren't compile for it.
Does any of you guys know how to do this?
Excel is able to open many different kinds of files beyond the .xls or .xlsx. Most common is CSV; it's dead simple but not very capable, and I would avoid it for all but the simplest applications.
A format I've used successfully is the Symbolic Link (SYLK) format. The .slk files open directly in Excel, and you can include cell formatting and formulas. It's easy to save out a file from Excel itself and use it as a template for creating your own files.
You're going to struggle to find a library to do this simply because WP (as of 7.1) doesn't include the System.IO.Packaging namespace, which most libraries will depend on to read/write docx/xlsx/etc files.

openXML SDK create Excel file

I am creating Excel files using OpenXML SDK 2.0.
Is it required to install OpenXML SDK in the server?
If possible, can someone send me a sample code to create Excel file without using a template?
Is it necessary to save the excel file created using OpenXML? I am creating the file but would not like to save it. Also, would be creating pivot tables in the excel file.
Thanks,
You will need to include the dll in order to use the sdk, which should get built out when you deploy.
I would recommend using a template since it will already contain a bunch of the XML that will make the Excel file valid and complete that you will not have to worry about adding. If you are totally against using one, then explore this blog for examples.
You will need to save the changes so that when you return the file it will contain your changes.
3) You can use a memory stream, SpreadsheetDocument has Create and Open functions based on stream, too (not only file path or package).

Categories

Resources