How to save an Excel sheet as PDF through MATLAB?
Show older comments
I am using the following code:
hExcel = actxserver('Excel.Application');
hWorkbook = hExcel.Workbooks.Open(sprintf('%s','C:\test.xlsx'));
hWorksheet = hWorkbook.Sheets.Item(1);
hRange = hWorksheet.Range('A1:O10');
hRange.ExportAsFixedFormat('xlTypePDF','test_out.pdf');
The Excel ActiveX server allows me to do the usual stuff, but the last line doesn't do anything. Neither does it throw any error.
Does anyone know how to do this?
1 Comment
Praveen
on 28 Dec 2016
hRange.ExportAsFixedFormat('xlTypePDF','test_out.pdf'); In this code give the path name, it works.. For example 'C:\test_out.pdf' instead of test
Accepted Answer
More Answers (1)
Intissar El Bouanani
on 10 Aug 2023
0 votes
it is possible to print the selected field in one page
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!