PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Fill a single table cell background colour
https://forum.pdfsharp.net/viewtopic.php?f=2&t=2780
Page 1 of 1

Author:  vence [ Mon Mar 31, 2014 9:43 am ]
Post subject:  Fill a single table cell background colour

Hi All,

I have just started using migradoc recently and I am currently stack with trying to colour a single cell within a table.

The problem I am finding is that the table cell does not get fill with the colour, but simply a strip of that colours is seen on the cell.

I believed this is because it is "setting the shading of the text in the cells - therefore the gap" as Thomas points in this http://forum.pdfsharp.net/viewtopic.php?f=2&t=480. However I still do not know how to fill the entire cell. My rows already have different colours to make reading easier, but i need to be able to set a particular cell with a different colour


Code:
                    cell = row.Cells[1];
                    cell.Borders.ClearAll(); //try playing with borders setting to not avail
                    cell.Borders.Visible = false; //try playing with borders setting to not avail
                    row.Cells[1].Format.Shading.Color = Styles.GetCellColour(can.CarColour);



Any help will be greatly appreciated.

Thanks

Author:  Thomas Hoevel [ Mon Mar 31, 2014 12:48 pm ]
Post subject:  Re: Fill a single table cell background colour

Try "row.Cells[1].Shading.Color" instead of "row.Cells[1].Format.Shading.Color" - the former sets the color of the cell, the latter sets the color of the text background.

Author:  vence [ Wed Apr 02, 2014 2:20 pm ]
Post subject:  Re: Fill a single table cell background colour

Thanks Thomas! I totally missed that, even when I read your previous thread! Sorry

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/