- Create COM server - MATLAB actxserver - MathWorks India
- How to run excel macro via MATLAB on another pc - MATLAB Answers - MATLAB Central (mathworks.com)
Is it possible to copy a figure into excel using a WebApp server?
1 次查看(过去 30 天)
显示 更早的评论
I can successfully copy a figure into an exel sheet using below function:
function xlswritefig(hFig,filename,sheetname,range)
copygraphics(hFig)
% Connect to Ecel
Excel = actxserver('Excel.Application');
% Open file and active worksheet
op = invoke(Excel.Workbooks, 'open', filename);
Sheets = Excel.ActiveWorkBook.Sheets;
n_sheets = Sheets.Count;
Sheets.Add([], Sheets.Item(n_sheets));
Sheets.Item(n_sheets+1).Name = sheetname;
target_sheet = get(Sheets, 'Item', sheetname);
invoke(target_sheet, 'Activate');
Activesheet = Excel.Activesheet;
% Paste to specified cell
Paste(Activesheet,get(Activesheet,'Range',range))
% Save and quit
invoke(op, 'Save');
invoke(Excel, 'Quit');
delete(Excel)
close(filename)
However, is it also possible to run this function (or actxserver) from a Web App if I install Excel on my virtuel machine (MS Azure)?
0 个评论
回答(1 个)
Vijay
2022-12-28
Hello @Jens Peter Hansen
Yes, you can create a create a COM server on your AZURE machine by supplying IP address of the remote machine from your MATLAB program.
Example
c = actxserver(progid,'machine',machineName)
%‘machinename' can be IP address of a remote computer or a name that can be resolved on your network.
For more information, please go through links below.
Hope that helps!
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!