insightsengineering / teal.reporter

Create and preview reports with Shiny modules
https://insightsengineering.github.io/teal.reporter/
Other
8 stars 9 forks source link

185 fixing table formatting in PPT outputs #211

Closed kartikeyakirar closed 10 months ago

kartikeyakirar commented 10 months ago

this PR fixes https://github.com/insightsengineering/teal.reporter/issues/185

Inspired by autoslidR, I have integrated flextable functionality to convert "data.frame," "rtables," "TableTree," and "ElementaryTable" into flextable, which offers a more accurate representation. In this context, I have enhanced the TableBlock to facilitate the conversion of tables into flextable.

Output screenshot

Screenshot 2023-09-08 at 7 20 48 PM
github-actions[bot] commented 10 months ago

badge

Code Coverage Summary

Filename              Stmts    Miss  Cover    Missing
------------------  -------  ------  -------  ----------------------------------------------------------------------------------
R/AddCardModule.R       140       1  99.29%   195
R/Archiver.R             25       0  100.00%
R/ContentBlock.R         18       2  88.89%   38-44
R/DownloadModule.R      207      49  76.33%   89-95, 138, 163-168, 177-181, 184-188, 196-200, 203-207, 214-218, 221-225, 262-266
R/FileBlock.R            13       0  100.00%
R/NewpageBlock.R          2       0  100.00%
R/PictureBlock.R         30       2  93.33%   15, 79
R/Previewer.R           295      56  81.02%   183, 197, 199-202, 205, 208-216, 325-369
R/RcodeBlock.R           15       0  100.00%
R/Renderer.R             90      19  78.89%   96, 104, 113, 115-133
R/ReportCard.R           77       4  94.81%   180, 219, 224, 245
R/Reporter.R             94       1  98.94%   254
R/ResetModule.R          55       0  100.00%
R/SimpleReporter.R       29       0  100.00%
R/TableBlock.R            9       0  100.00%
R/TextBlock.R            13       0  100.00%
R/utils.R               139      69  50.36%   7, 38-97, 99, 102-109, 158-160
R/yaml_utils.R           74       2  97.30%   41, 239
TOTAL                  1325     205  84.53%

Diff against main

Filename          Stmts    Miss  Cover
--------------  -------  ------  --------
R/Renderer.R         +6      +6  -5.63%
R/TableBlock.R       +1       0  +100.00%
R/utils.R           +61      +3  +34.98%
TOTAL               +68      +9  +0.12%

Results for commit: 214841dc15a062680e40fb487146057ea12d9618

Minimum allowed coverage is 80%

:recycle: This comment has been updated with latest results

github-actions[bot] commented 10 months ago

Unit Tests Summary

    1 files    18 suites   13s :stopwatch: 202 tests 202 :heavy_check_mark: 0 :zzz: 0 :x: 341 runs  341 :heavy_check_mark: 0 :zzz: 0 :x:

Results for commit 0e9765b6.

:recycle: This comment has been updated with latest results.

kartikeyakirar commented 10 months ago

Instead, table is printed to graphical device, so extra window in my IDE gets open

In PR I was saving a 'flextable' instead of 'rtables,' in rds which was not being converted into an HTML element in preview module. This problem has been fixed using the 'flextable::htmltools_value' function.

image