- In the Excel file/sheet you are writing to, go to Review>>Protect Sheet. Make sure that 'Format Columns' and 'Format Rows' are unchecked, then press OK
- When using writetable with the protected sheet, use the Name/Value pair ('UseExcel', true)
writetable resizing column widths
22 ビュー (過去 30 日間)
古いコメントを表示
I am using the following:
writetable(Variable ,'Location', 'Sheet', 'Sheet Name', 'Range', Range, 'WriteVariableNames', false)
It works correctly in writing although it resizes the columns in excel. It is writing to the end of an existing table. Is there any way to avoid this?
1 件のコメント
Danny Smith
2022 年 11 月 15 日
I was able to avoid auto-resizing of Excel columns when using writetable via a 2-step process:
採用された回答
Calvin Ebert
2019 年 7 月 31 日
1 件のコメント
Alex Calder
2020 年 10 月 29 日
Can you please provide an example, or link to where one is given? Your comment doesn't make it clear exactly what info you are wrting where and in what order. Thanks.
その他の回答 (1 件)
Walter Roberson
2019 年 5 月 8 日
No, there is no way to avoid it with writetable(). writetable() does not attempt to preserve formatting or templates or graphics or formulas written into the range.
To have any of those preserved, you need to use actxserver() or a .NET interface to talk to Excel to tell it what needs to be done.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!