Author Topic: Style Information on Export  (Read 4144 times)

klartextmedia

  • Newbie
  • *
  • Posts: 5
    • View Profile
Style Information on Export
« on: October 23, 2017, 08:00:53 pm »
Hi

How can I export the table with all currently set style informations on a cell (color, size etc.). I can set it by pq_cellattr option or by JavaScript...
The user can resize it by mouse, but how do I get this information on export?

Regards

klartextmedia

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Style Information on Export
« Reply #1 on: October 24, 2017, 12:27:23 am »
ok, meanwhile i've figured out that i can get the data after and grid.refreshCM with accessing grid.colModel. And there is no way to give an height to an row (is this correct?)

klartextmedia

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Style Information on Export
« Reply #2 on: October 24, 2017, 02:40:29 pm »
ok, it seems that I need to collect all values on the dom :-(. Is there really no easy way to export to an html table with all cell informations (width, bgcolor, textcolor, textstyle etc.)?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Style Information on Export
« Reply #3 on: October 24, 2017, 11:39:08 pm »
Style information via pq_cellattr or column.render is exported to Excel

but only inline styles set inside column.render can be exported to html. Example red text color in column C are exported in https://paramquery.com/pro/demos/print

Another way is to render all rows and columns of the grid with height:'flex' and width:'flex' and just print the grid directly.

There is no need to set row height in pqgrid as rows have auto height based on the content in cells which is better than manually setting each row height. Example: https://paramquery.com/pro/demos/treegrid-lazy

klartextmedia

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Style Information on Export
« Reply #4 on: October 25, 2017, 11:48:05 am »
it works, thx. I thougth that i can export the current style information of the td tag, but it's also okay to render a container around the inner html.

@manual height:

I will use pqgrid for a calculation module in a intranet where customers can design their own calculation sheet with the grid as they know it from excel... therefor it would be great if there could
be an option for manual rowheight in future. For the moment they should use newlines to expand empty cells :-).


klartextmedia

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Style Information on Export
« Reply #5 on: October 25, 2017, 12:38:02 pm »
next problem :(

renderer return the following:  return "<span style='"+ui.style+";width:"+ui.column._width+"px;display:block'>"+ui.cellData+"</span>";

cellData and _width are returned correctly, but ui.style  is always  undefined. What can be the reason for this?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Style Information on Export
« Reply #6 on: October 31, 2017, 10:20:46 pm »
1. I agree there is a need to map height or rows to Excel export, would be added in the upcoming versions.

2. style and _width ( it's private property ) are not ui properties.

If you are trying to take the whole width of cell, then use a normal div or a div with % width.