Excel css/rowstyle problem

(3 posts) (2 voices)
  1. lll.vis, Member

    Hello,
    I created a report using the command css (or rowstyle) to having an alternate rows color
    select 'dbr.css', 'tr.odd td { background: #D9D9D9;}';

    On the browser it works properly. But when I export into excel all the rows have a white background color.

    Only if I use cellstyle (cell by cell) I have the correct background color into excel.

    I am using the last version of mydbr. It's updated.
    Is there a solution to use a simple command as css/html/rowstyle/rowclass to having a correct style into excel?

    Regards
    Lamberto

  2. myDBR Team, Key Master

    Excel does not have an equivalent of CSS selectors. What you can do is to use dbr.rowstyle to set the style. myDBR will translate the most common CSS definitions to Excel formatting.

    select 'dbr.rowstyle', 'rowstyle';
    set @row = 0;
    select a, if ((@row:=@row + 1) % 2=0, 'background: #D9D9D9;', '') as 'rowstyle'
    from (
    select 'A' as a
    union
    select 'B'
    union
    select 'C'
    union
    select 'D'
    union
    select 'E'
    union
    select 'F'
    ) as q;

    --
    myDBR Team

  3. lll.vis, Member

    Thanks. I used your code. It works.


Reply

You must log in to post.