CSV file convert to pdf file

Posted by Plhkrishna under C# on 10/4/2017 | Points: 10 | Views : 317 | Status : [Member] | Replies : 1
Hi,
i am working for c#.net windows applications,
after uploading csv file ,it should be convert into pdf file,
can any one give code for this

.net developer


Responses

Posted by: Prabahkar on: 10/8/2017 [Member] Starter | Points: 25

Up
0
Down
try this

using Spire.Xls;

namespace CSV2PDF
{
class Program
{
static void Main(string[] args)
{
Workbook wb = new Workbook();
wb.LoadFromFile("SampleCSVFile_119kb.csv", ",",1,1);
wb.ConverterSetting.SheetFitToPage = true;
Worksheet sheet = wb.Worksheets[0];
for (int i = 1; i < sheet.Columns.Length; i++)
{
sheet.AutoFitColumn(i);
}
sheet.SaveToPdf("toPDF.pdf");
System.Diagnostics.Process.Start("toPDF.pdf");
}
}
}



Plhkrishna, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response