PPTX.jl icon indicating copy to clipboard operation
PPTX.jl copied to clipboard

Tables with colors

Open matthijscox-asml opened this issue 1 year ago • 2 comments

Note: this is mostly a brainstorm with myself.

I recently saw many colleagues automatically create tables with colors from scripts.

For example, coloring the background of a table element red or green based the value of a number in the table element. Managers love those kind of quick overviews. And of course change the font color (at least to black or white depending on the background color).

Stuff such as this:

image

There's all these other configurations, like border colors. But let's start with something simple, such as the background color.

Main trouble is how to make this a bit user friendly. My only guess right now would be to make a table/dataframe/matrix object where the elements are not just strings, but TextBox, or TableElement types or something, with lots of properties that you can change. That would give full flexibility per table element at least.

(May have to combine this with easier TextBox/TextBody configuration, font/alignment/etc. Maybe consider to use the same API as Makie.Text?)

(We could also add like a formatter function to the PPTX.Table, to style each element based on the content, see PrettyTables.jl for example. Maybe Term.jl has some good ideas as well.)

matthijscox-asml avatar Aug 17 '23 07:08 matthijscox-asml

What if PrettyTables.jl had an XML backend ..

jaakkor2 avatar Aug 17 '23 07:08 jaakkor2

What if PrettyTables.jl had an XML backend ..

Interesting idea :) But actually it would be a PPTX backend, because there is no standard way to define a table in XML. So I wonder if there would be any benefit to add that code to PrettyTables.jl instead of here.

matthijscox-asml avatar Aug 17 '23 08:08 matthijscox-asml

v0.10.0 has these features, I added an example to the docs on how to generate the table in the original post.

matthijscox-asml avatar Oct 28 '24 15:10 matthijscox-asml