I have a task that requires generating a pdf that has the salary details of an employee. The data is stored in a custom list. I need to use some kind of template for the pdf to show the data in an organized manner. How do I get on with it?

I have to do it in an autohosted app that goes to a office 365 site.

Thanks in advance.

1 Answer 1


I first added a template to a doc library that was of the excel type. Then I used microsoft.office.interop.excel to edit an instance of the template in a workbook and then convert it into pdf.

//For workbook:

Excel.Application app = new Excel.Application();
Workbook wb = app.Workbook.Open("templateurl", ...parameters...);
Sheets sheets = wb.Worksheets;
Worksheet sh =(Worksheet) sheets.get_Item(1);

//then populate it
sh.Cells[row, column] = value

// save it locally


Then I uploaded it to another document library then used

workBook.ExportAsFixedFormat(targetType, targetPath, XlFixedFormatQuality.xlQualityStandard, true, false, Type.Missing, Type.Missing, Type.Missing, Type.Missing);

That gave me the pdf :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.