ngs-doo / TemplaterExamples

Creating reports in .NET and Java
https://templater.info
The Unlicense
48 stars 27 forks source link

Can I add color to table column content in a PowerPoint presentation? #42

Closed tleclaire closed 2 years ago

tleclaire commented 2 years ago

Hello,

before purchasing, I need to know, if the CollapseRegion sample would also work for PowerPoint presentations?

Thanks Thomas

zapov commented 2 years ago

Hi,

collapse is supported in PowerPoint too. If you want to paste text with color in table you have to do it similarly to other examples.

PP uses something like this (XML type):

<a:r xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
    <a:rPr lang="en-US" dirty="0" smtClean="0">
        <a:solidFill>
            <a:srgbClr val="C00000"/>
        </a:solidFill>
    </a:rPr>
    <a:t>in color</a:t>
</a:r>

it would replace tag with red in color text. There is relevant example here: https://github.com/ngs-doo/TemplaterExamples/tree/master/Beginner/DataSet%20(.NET)

tleclaire commented 2 years ago

I'll check it out... Thanks!

tleclaire commented 2 years ago

Hi Zapov,

I can't get this to work, tried to modifiy the PresenationTables sample but when I inject the provided XML, PowerPoint wants to repair the slide or there is no content, do you have a working sample available? I tried the tag like this: [[table1.colB]:merge-xml] or add a Color Tag like this [[Color]:merge-xml]. I need to color the background conditionally.

Thanks and best regards Thomas

zapov commented 2 years ago

If you want to change background too XML must be somewhat different. This works:

<a:tc xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
  <a:txBody>
    <a:bodyPr/>
    <a:p>
      <a:r>
        <a:rPr>
          <a:solidFill>
            <a:srgbClr val="000000"/>
          </a:solidFill>
        </a:rPr>
        <a:t>in black</a:t>
      </a:r>
    </a:p>
  </a:txBody>
  <a:tcPr>
    <a:solidFill>
      <a:srgbClr val="C00000"/>
    </a:solidFill>
  </a:tcPr>
</a:tc>

I did notice that merge-xml does not behave as expected in some cases ;( but you can use replace-xml

I can put it in some example later if you cant get it to work with this example

tleclaire commented 2 years ago

This works, thank you very much!

zapov commented 2 years ago

Hi @tleclaire

hopefully you got everything working. Next version will support this special metadata directly through xml for easier usage. I'll close this as it should be resolved.