File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,32 @@ function fontColor(uielement, newcolor)
118118 end
119119 end % aboutDojo
120120
121+ function [fullHTML ] = getHTML(hUIFig )
122+ % A method for dumping the HTML code of a uifigure.
123+ % Intended for R2017b (and onward?) where the CEF url cannot be simply opened in a browser.
124+
125+ win = mlapptools .getWebWindow(hUIFig );
126+ % Get the outer html:
127+ fullHTML = win .executeJS(' document.documentElement.outerHTML' );
128+ % Replace some strings for conversion to work well:
129+ fullHTML = strrep(fullHTML ,' %' ,' %% ' );
130+ fullHTML = strrep(fullHTML ,' ><' ,' >\n <' );
131+ % Append the DOCTYPE header and remove quotes:
132+ fullHTML = sprintf([' <!DOCTYPE HTML>\n ' fullHTML(2 : end - 1 )]);
133+
134+ %% Optional things to do with the output:
135+ % Display as web page:
136+ %{
137+ web(['text://' fullHTML]);
138+ %}
139+ % Save as file:
140+ %{
141+ fid = fopen('uifig_raw.html','w');
142+ fprintf(fid,'%s',fullHTML);
143+ fclose(fid);
144+ %}
145+ end % getHTML
146+
121147 end % Public Static Methods
122148
123149 methods (Static = true , Access = private )
You can’t perform that action at this time.
0 commit comments