From 1f3ae372feb28b5c7dfae2a67fa758a5d72100d4 Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Mon, 28 Jul 2014 16:32:17 +0200 Subject: [PATCH] =?UTF-8?q?reporting:=20fix=20bug=20where=20a=20whole=20ro?= =?UTF-8?q?w=20wasn=E2=80=99t=20colored=20if=20the=20tableSubSectionHeader?= =?UTF-8?q?=20option=20was=20passed=20at=20the=20same=20time?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- matlab/reports/@report_series/writeSeriesForTable.m | 8 ++++++-- matlab/reports/@report_table/writeTableFile.m | 2 +- tests/reporting/AnnualTable.m | 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/matlab/reports/@report_series/writeSeriesForTable.m b/matlab/reports/@report_series/writeSeriesForTable.m index a0e78310d..edda0b0b1 100644 --- a/matlab/reports/@report_series/writeSeriesForTable.m +++ b/matlab/reports/@report_series/writeSeriesForTable.m @@ -1,5 +1,5 @@ -function o = writeSeriesForTable(o, fid, dates, precision) -%function o = writeSeriesForTable(o, fid, dates, precision) +function o = writeSeriesForTable(o, fid, dates, precision, ncols) +%function o = writeSeriesForTable(o, fid, dates, precision, ncols) % Write Table Row % % INPUTS @@ -7,6 +7,7 @@ function o = writeSeriesForTable(o, fid, dates, precision) % fid [int] file id % dates [dates] dates for report_series slice % precision [float] precision with which to print the data +% ncols [int] total number of columns in table % % % OUTPUTS @@ -69,6 +70,9 @@ if ~isempty(o.tableRowColor) end if ~isempty(o.tableSubSectionHeader) fprintf(fid, '%s', o.tableSubSectionHeader); + for i=1:ncols-1 + fprintf(fid, ' &'); + end fprintf(fid, '\\\\%%\n'); return; end diff --git a/matlab/reports/@report_table/writeTableFile.m b/matlab/reports/@report_table/writeTableFile.m index 5721583d8..575402ea1 100644 --- a/matlab/reports/@report_table/writeTableFile.m +++ b/matlab/reports/@report_table/writeTableFile.m @@ -170,7 +170,7 @@ fprintf(fid, '%%\n'); % Write Report_Table Data for i=1:ne - o.series{i}.writeSeriesForTable(fid, o.range, o.precision); + o.series{i}.writeSeriesForTable(fid, o.range, o.precision, ncols); if o.showHlines fprintf(fid, '\\hline\n'); end diff --git a/tests/reporting/AnnualTable.m b/tests/reporting/AnnualTable.m index b29abd5ef..fb78267f2 100644 --- a/tests/reporting/AnnualTable.m +++ b/tests/reporting/AnnualTable.m @@ -20,6 +20,8 @@ shortNames = {'US', 'EU', 'JA', 'EA6', 'LA6', 'RC6'}; longNames = {'Coca Cola', 'Kinder Bueno', 'Pizza', ... 'Vegetarianism Is Good', 'OS X', 'Dothraki'}; +rep = rep.addSeries('tableSubSectionHeader', 'A group', ... + 'tableRowColor', 'red!22'); for i=1:length(shortNames) db_a = db_a.tex_rename([seriesRootName shortNames{i}], longNames{i}); rep = rep.addSeries('data', db_a{[seriesRootName shortNames{i}]});