xlsread merge & center and highlight in red
조회 수: 4 (최근 30일)
이전 댓글 표시
I am writing an xlswrite file and I want to write a header before I imput my date. I want to know if I can write a command to Merge & Center text in a specific line of the file. For example, I want to write a file that merges 'Title' from A1 to I1. Can I do this in MATLAB?
I would also like to write in the excel file an array that is written in red font. How do I do this? I wasn't sure what to ask the help search results to learn how to do this myself.
--Ender--
댓글 수: 0
답변 (2개)
Iain
2014년 8월 13일
Ok, theres three things you have to do:
1. Determine the visual basic code that excel uses to achieve that. Record a macro or whatever to get the code.
2. View the matlab code for xlsread & xlswrite to learn a bit about how matlab uses visual basic commands to control excel via activeX.
3. Put the two together.
댓글 수: 0
Ilyas
2014년 10월 20일
True = 1;
False = 0;
xlCenter = -4108;
excelOutputFileName = 'full path\excelfile.xlsx'
Excel = actxserver('Excel.Application');
Excel.Visible = 0; % to see the excel file real time make 1;
Workbook = Excel.Workbooks.Open(excelOutputFileName);
Range = Excel.Range('A1:I1');
Range.Select;
Range.MergeCells = True;
Range.HorizontalAlignment = xlCenter;
댓글 수: 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!