How to autofit the cell width when exporting the output from HTML to Excel

Reply
Occasional Contributor
Posts: 16

How to autofit the cell width when exporting the output from HTML to Excel

When we try to create the Excel output style from the Html, the content is correct but the cell width for some columns is large (probably come with original format), what is the good way to let the excel cell has width autofit with the value and removing the trailing blanks? should any _odsoptions can resolve this?

Thank you!

the related code in the stored process as follows:

%global _ODSDEST _ODSSTYLE _ODSOPTIONS:

%macro print;

%local ODS_HEADER OUTPUT_FORMAT;

%let output_format = &_ODSDEST;

%if (%upcase(&_ODSDEST) eq HTML2EXCEL) %then %do;

%let _ODSDEST = tagsets.ExcelXP;

%let _OUTPUT_FORMAT = HTML;

%let OLD_HEADER=

%sysfunc(stpsrv)header(Content-type, application/vnd.ms-excel));

%end;

.....

%mend print;

%print;

Ask a Question
Discussion stats
  • 0 replies
  • 188 views
  • 0 likes
  • 1 in conversation