How to merge cells in excel

98 次查看(过去 30 天)
I want to merge cells A1 to E1... and give a heading with different colour and font... how to do it through matlab code....
  1 个评论
king excel
king excel 2018-10-28
You can merge cells or rows or columns values easily using Dose for Excel Add-In: https://www.zbrainsoft.com/excel-merge.html

请先登录,再进行评论。

采纳的回答

KL
KL 2017-4-27
编辑:KL 2017-4-27
Check here .
e = actxserver('Excel.Application');
% Add a workbook.
eWorkbook = e.Workbooks.Add;
e.Visible = 1;
% Make the first sheet active.
eSheets = e.ActiveWorkbook.Sheets;
eSheet1 = eSheets.get('Item',1);
eSheet1.Activate
% Merge Cells
eSheet1 = eSheet1.get('Range', 'A1:E1');
eSheet1.MergeCells = 1;
eSheet1.Value = 'text here';
eSheet1.Font.ColorIndex = 3
eSheet1.Font.Bold = 1;
  4 个评论
KL
KL 2017-4-27
then you have to change
eWorkbook = e.Workbooks.Add;
to
eWorkbook = e.Workbooks.Open(file);
where 'file' should be filename with fullpath. ('C:\file.xlsx')
Ricardo Gutierrez
Ricardo Gutierrez 2020-6-27
Very good. But, if I want to save the file from matlab, how should I do it?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Use COM Objects in MATLAB 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by