Have a HEX
colour code string in the database ("#ADD8E6"
) and I want to use this to change the background colour of a MigraDoc
cell. I have found Color.Parse()
function, however it isn't changing the colour of my cell. I have had to do the following:
string colourHex = (database.HexCode).Replace("#", "0x");
var colourObject = MigraDoc.DocumentObjectModel.Color.Parse(colourHex);
Cell.Shading.Color = colourObject;
I know that the Cell.Shading.Color
is correct because if I apply Cell.Shading.Color = Colors.AliceBlue
then the cell does change colour as expected. I understand the Color.Parse
requires the HEX
code to start with 0x
rather than #
. I tried using the #
and it failed... At least with what I have got it is rendering... just not with my colour.
Color.Parse
method (see my answer). Thanks for asking your question. – Scute