how to add title/caption to FormalTable ?
18 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
SRUSHTI KHATAU
el 20 de Nov. de 2021
Comentada: SRUSHTI KHATAU
el 25 de Nov. de 2021
I want to add caption/title to the table. I am making tables using FormalTable but could not find the property to add caption to it. Please help
0 comentarios
Respuesta aceptada
Srijith Kasaragod
el 23 de Nov. de 2021
3 comentarios
Srijith Kasaragod
el 25 de Nov. de 2021
Editada: Srijith Kasaragod
el 25 de Nov. de 2021
Base table provides an option to specify a numbered title to the table. So inorder to add a title to a Formal table, you can first create a Formal table and then create a Base table from it. The following piece of code shows an example:
import mlreportgen.dom.*
import mlreportgen.report.*
%Create a report
rpt = Report("mydoc","pdf");
open(rpt);
%Create a FormalTable
t = FormalTable({'Col1', 'Col2'}, {'entry11', 'entry12'; 'entry21', 'entry22'});
tableStyles = { ColSep("solid"), ...
RowSep("solid"), ...
Border("solid"), ...
Width("4in")};
% Specify styles for the header first row
headerRow = t.Header.Children(1);
headerRow.Style = [headerRow.Style {Bold()}];
%Create BaseTable from FormalTable and add to report
chapter = Chapter();
chapter.Title = "Table example";
add(rpt,chapter);
table = BaseTable(t);
table.Title = "Formal table to Base table";
add(rpt,table);
%Close and view report
close(rpt);
rptview(rpt);
Hope this helps!
Más respuestas (0)
Ver también
Categorías
Más información sobre MATLAB Report Generator Task Examples en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!