File Exchange

image thumbnail

Html Table Writer

version 1.1.0.0 (3.43 KB) by Roger Parkyn
Writes a cell-array to an html file. Numerous formatting options are available.

3 Downloads

Updated 01 May 2013

View Version History

View License

Writes a cell-array to an html file for display via html browsers. Numerous formatting options are available to customise the look.
Optionally, as well as the output html file, it is also possible to output the result as a string variable in Matlab. Formatting options include font and background colours, including over-rides for specified rows.

Cite As

Roger Parkyn (2021). Html Table Writer (https://www.mathworks.com/matlabcentral/fileexchange/25078-html-table-writer), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (13)

Roger Parkyn

Lavi, In short: no. It might (?) be possible to convert your numbers to a cell-array of strings, in that format, and then write that.

Lavi Sekundo

Great function!!!
Is there a way to format the numeric values to comma separated at the thousands e.g. from 100000 to 100,000

Roger Parkyn

Hi Lukasz, You can see the options that are currently coded in the section where p.addParamValue gets specified (at the start of the code). I'm not exactly sure what formatting you require but it may be possible for you to add it to those specs and then adapt the code to utilise that parameter value.

Lukasz Piasta

how can i add more conditions related with font color? NegativeCellFontColour2 and NegativeCellFontColour3 ... does not work

dalis44

could we use it directly insideof:
fprintf(fid,['\t\t<table style=" color:',p.Results.FontColor,'; ',...
'font-size:', num2str(p.Results.FontSize),'; ',...
'font-family:', p.Results.FontFace,'; ',...
'text-align:', p.Results.TextAlign,'; " ',...
'cellpadding="',num2str(p.Results.CellPadding),'" ',...
'cellspacing="',num2str(p.Results.CellSpacing),'" ',...
'border="',num2str(p.Results.BorderSize),'" ',...
'bordercolor="',p.Results.BorderColor,'" ',...
'bgcolor="',p.Results.BackgroundColor,'"',...
'width="',p.Results.width,'"',...
' ><col width="130">\n']);
fprintf(fid,['\t\t\t<caption>',p.Results.Caption,'</caption>\n']); %add the caption

Roger Parkyn

Dalis: It is relying on the default column widths. It would be possible to get it to add lines to specify widths, like:
<col width="130">
but that hasn't been coded in this function sorry.

dalis44

Very usefull topic , but how to set desired constant width for each column is there any sollution for this ? Thank you !

Kaveh

Roger Parkyn

Joshua: Nice to hear, thanks. I don't know anything about Latex in html but except to say that if you can express it in text that html will understand then it "should" display as table contents.

Joshua

Thanks for the great function! Any advice on how to put Latex markup (like theta hat) as column headings?

Darik

Roger Parkyn

Ulf: thanks for the comment and rating! The file has been up for a few years and has been really useful for me at least so it is nice to see someone comment at last.

Ulf

greatly tool, that was what I'm looking for. Now I can easily print the content of my cell variables into an html-file. Thank you for this great job.

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired: HTMLtable

Community Treasure Hunt

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

Start Hunting!