- 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!