color problem in writing excel usign c#?

C

chandan

Hi,
When I try to set color of cell in excell,it sets the different color
that I try to set.
If I try this code then it set Red color instead of Blue color.Let me
point out my problem.
I am uing c# and VS2008.


public void addData(int row, int col, string data, string cell1,
string cell2, string format)
{
worksheet.Columns.AutoFit();

worksheet.Cells[row, col] = data;
workSheet_range = worksheet.get_Range(cell1, cell2);
workSheet_range.Merge(true);
workSheet_range.Interior.Color =
System.Drawing.Color.Blue.ToArgb();

}

How can I set the color?


Thanks,
Chandan kumar
 
C

chandan

Hi,
 When I try to set color of cell in excell,it sets the different color
that I try to set.
 If I try this code then it set Red color instead of Blue color.Let me
point out my problem.
 I am uing c# and VS2008.

public void addData(int row, int col, string data, string cell1,
string cell2, string format)
        {
            worksheet.Columns.AutoFit();

            worksheet.Cells[row, col] = data;
            workSheet_range = worksheet.get_Range(cell1, cell2);
            workSheet_range.Merge(true);
            workSheet_range.Interior.Color =
System.Drawing.Color.Blue.ToArgb();

        }

How can I set the color?

Thanks,
Chandan kumar

Finally I got the solution but it works only for known clours.
Try to use Color.TraslateOle ....

Thanks,
Chandan
 
M

Mike

chandan said:
Finally I got the solution but it works only for known clours.
Try to use Color.TraslateOle ....

I have the same problem but when I set the interior to red the color is
actually blue. I did a search on color.translateloe but I didn't find
anything. Could you post a snippet of code that shows your solution?

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top