c# - Convert a list of excel sheets (sheet name list provided) into a single PDF file -


i need add selected set of sheets pdf using microsoft.office.interop.excel library in c#. have been searching throught net figure out how this. haven't been able find helpful. can me this. found following statement convert given sheet pdf. looks like, cannot append list of excel sheets 1 pdf when provide sheet names.

xlws.exportasfixedformat(excel.xlfixedformattype.xltypepdf, endpath); 

help please.

you can use worksheet.exportasfixedformat method.

example:

string exportfilepath = @"c:\desktop\test.pdf"; activeworksheet.exportasfixedformat(xlfixedformattype.xltypepdf, exportfilepath); 

or can use workbook.exportasfixedformat method

string exportfilepath = @"c:\desktop\test.pdf"; activeworksheet.exportasfixedformat(xlfixedformattype.xltypepdf, exportfilepath); 

references:

https://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.worksheet.exportasfixedformat.aspx

https://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.workbook.exportasfixedformat.aspx


Comments

Popular posts from this blog

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

android - ConstraintLayout: Realign baseline constraint in case if dependent view visibility was set to GONE -

c# - Populating Gridview inside Listview ItemTemplate On Web User Control from Code Behind -