Qlik Community

Qlik NPrinting Discussions

Discussion Board for collaboration on Qlik NPrinting.

cancel
Showing results for 
Search instead for 
Did you mean: 
adang
Contributor III
Contributor III

HTML table styling does not work with with "Keep Source Formats"

Like the title said; HTML styling like border lines, padding space do not work when "Keep Source Format" is checked.

This is quite an issue when the values are formatted with text colors, bolden font when certain conditions are met and could not be recreated in NPrinting. The Qlik formatting will not be preserved when disabling Keep Source Format. 

Has anyone here found a way to get around this?

Labels (2)
1 Solution

Accepted Solutions
Lech_Miszkiewicz

Hi @adang , @Ruggero_Piccoli , @Frank_S 

This is my example:

Simple table in Qlik Sense with:

  1. Dimension 1 = Dim1
  2. Dimension 2 = Dim2
  3. Measure: Sum(Expression)
    1. This measure has variable vTextColour set as font/text colour
    2. This measure has vcariable vBackgroundColour set as cell background colour
  4. Measure which shows me what is the font/text colour RGB value
  5. Measure which shows me what is the background colour RGB value

Lech_Miszkiewicz_0-1642806091962.png

I bring this table to HTML Report and as shown on the picture I use Dimension 1, Dimension 2, and Measure to build my table content and another 2 columns I use to populate style values by passing their respective tags as marked on screenshot:

  1. font color as $(vTextColour) column from my Qlik Sense table
  2. background color as $(vBackgroundColour) column from my Qlik Sense table

Please note that for style I had to disable HTML Encode parameter as shown on screenshot

Lech_Miszkiewicz_1-1642806564995.png

 

When you preview my template you get this - table where every cell can be controlled conditionally based on values calculated in Qlik Sense.

  1. Lech_Miszkiewicz_2-1642806806689.gif

     

I said from the very beginning that this requires planning and appropriate design but certainly is possible.

cheers

Lech

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.

View solution in original post

19 Replies
adang
Contributor III
Contributor III
Author

How the chart looks in Qlik

adang_0-1642521326884.png

Qlik formatting preserved when Keep Source Format checked; but does not look any good without HTML styling for the border.

adang_1-1642521476722.png

Lost all the Qlik formatting when "Keep Source Format" disabled to make HTML styling work

adang_2-1642521608662.png

 

 

 

 

Frank_S
Support
Support

Hi @adang

 

If you want more control over your HTML NP report output I suggest using a tool like the table generator found on this site. It is an external link which I found to be safe but use at your discretion.

I use this tool to format my table to make it appear as I would like to see it in my report output

 

In the template editor

  • copy paste the table generator code into the NP template editor.
  • Insert the header titles and table data
  • remove the 'keep source formats' check box
  • use the 'hide' option for the 'show header' property. (This prevents duplicate headers)

See below for a sample of the report design and output.

 

Hope this helps...

 

 

 

We are just 'like' you and like to be liked when providing a helpful answer. You may also press the 'Solution Accepted' button if an answer provided resolves your question or issue... Cheers!
Lech_Miszkiewicz

Hi @adang,

What are the conditions which cannot be recreated in NPrinting? I know it may not obvious but as far as I am concerned I was able to do quite a lot with HTML tables. 

I understand that there might be additional work required but you should be able to achieve all sorts of conditional formatting by creating CSS syntax directly in Qlik for each corresponding row (and/or cell).

we discussed this  here:

https://community.qlik.com/t5/Qlik-NPrinting-Discussions/Nprinting-HTML-How-change-background-color-...

 

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
Ruggero_Piccoli
Support
Support

Hi,

Please refer to https://help.qlik.com/en-US/nprinting/May2021/Content/NPrinting/HTMLReports/HTML-formatting.htm

"Keep source format" activated tells to Qlik NPrinting to do its best efforts to replicate the original format in QlikView or Qlik Sense. Best efforts in the meaning that it is not always possible to replicate perfectly the original style. This option is active by default.

If you uncheck "Keep source format" original formats are removed and you can customize it by using the native features of the type of template you are developing. For example with HTML you can write custom HTML style code.

Best Regards,

Ruggero



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.
adang
Contributor III
Contributor III
Author

Hey thank you for the suggestions! However, I have read that thread before starting this new one.

And here is an example: values in a specific column (metric) represent number of days to complete an order. this order is then tied to a "deliver by" date; and this "day to make" metric will be colored as red or green based on the comparison to the number of day between report date and delivery by date. As far as I know, this conditional formatting can only be done in Qlik. Because the HTML table does not look at the line item level. Putting a table here so that it's easier to show what I meant.

adang_0-1642602352963.png

 

adang
Contributor III
Contributor III
Author

This is not helping because as you can see in the screenshots I sent in the initial post, the borders do not show in the HTML table and make a quite messy table.

adang
Contributor III
Contributor III
Author

The issue here is not about creating HTML tables, because as you can see in the 3rd screenshot, it's already done there. However, in order to show the table borders, I had to disable keep source format, which made the value loose conditional coloring on the text value.

 

 

Ruggero_Piccoli
Support
Support

Hi, 

I understand what you want to have but you cannot "partially disable" the "Keep source format"; you have it enable, so the conditional format of the number works, or you disable it and loose all formats. The "Keep source format" enabled does its best efforts to replicate the Qlik Sense formats but it could be not not able to do everything in some cases and HTML has not advanced features to format the output like Excel for example.

You could try to export the original table as an image instead of an HTML native table. Are you developing an HTML report to embed it in the email body? What is your final goal?

Best Regards,

Ruggero



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.
adang
Contributor III
Contributor III
Author

Yes; it's an HTML report. I have got to the part where we could publish the data in text with HTML tables. However, there's a requirement that the values need to be color-coded so that it'd be easier for the recipients to identify where the issue is. And this is where I am stuck. 

This is not a problem, if we could have an option in Qlik to force the HTML column to show borders. But that's not an option right now I feel.