actxserver move data in entire row few rows down
1 次查看(过去 30 天)
显示 更早的评论
I am trying to use actxserver to format header row in an excel spreadsheet.
Before I manipulate header row, I would like to shift information in the second row (data row) down few rows to make additional spaces of rows between the header row and the data row.
I am having trouble doing seemingly simple task.
What I currently have is this:
function reformatHeader(excel_filename)
% Connect to the Excel COM object and open excel_filename
excel = actxserver('Excel.Application');
excel_wb = excel.Workbooks.Open(excel_filename);
sheet = excel_wb.ActiveSheet();
% Get the size of the sheet; assumes rectangular and not ragged
nColumns = sheet.Range('A1').End('xlToRight').Column;
nRows = sheet.Range('A1').End('xlDown').Row;
% Number of rows to add
nRowsToAdd = 2;
% I want to move the second row down by nRowsToAdd here
Basically the content of nRows should be moved to nRows+nRowsToAdd
There seems to be surprising little about of resources.. Is there a proper documentation with all commands?
I am using this at the moment, which isn't sufficient to do such simple operation: https://www.mathworks.com/help/matlab/matlab_external/using-a-matlab-application-as-an-automation-client.html
Thank you in advance.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File 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!