Current height of a row & color of text


#1

HI,

I am facing two problems -

1) I need to display a text in two different colors. The code is as given below

int currRow = 9;

cells[currRow, 2].PutValue(" Confidentiality: Private");

cells[currRow, 2].Characters(0, 18).Font.Color = System.Drawing.ColorTranslator.FromHtml("#B9A06A");

cells[currRow, 2].Characters(18, 26).Font.IsBold = true;

for (int i = 1; i <= 9; i++)

{

cells[currRow, i].Style.ForegroundColor = System.Drawing.ColorTranslator.FromHtml("#FFFF99");

cells[currRow, i].Style.Pattern = BackgroundType.Solid;

}

the foreground color is appearing right, but the color from the word "confidentiality" is represented as purple.When I tried using "#B9A06A" for a text in a HTML page its displayed a color nearing to brown or deep orange. How do I solve this? Please see pic1 to understand what I am aiming for.

2) Secondly I need to get the current height of the current row. How can I get this?

Rgds,

Soumya


#2

Hi Soumya,

Thanks for considering Aspose.

For second problem, please try Cells.GetRowHeight() and GetRowHeightPixel() methods to get the height of any row.

For first issue we will check and response you soon.

Regards

Amjad Sahi

Aspose Nanjing Team


#3

Hi,

Well for (1) issue, the font color is not in the Workbook Color Palette, so you have to add the color into the Color Palette first.

So you can add a line at the start in your code after instantiating your Workbook:

wkb.ChangePalette(System.Drawing.ColorTranslator.FromHtml("#B9A06A"),55);

I tested it with your code and it 's fine.

You may also refer:

http://www.aspose.com/Wiki/default.aspx/Aspose.Cells/ColorAndPalette.html

Regards

Amjad Sahi

Aspose.Nanjing Team.