I am using C# to generate an Excel spreadsheet and saving it in Excel 2003 XML format using this library. I need to make a cell that contains a big X. The sample sent by the client uses a left and right diagonal border to accomplish this.
I’ve have been unable to find the correct code syntax to set a cell’s style in this manner. How is this done?
Here is how it is supposed to look:
in XML saved from Excel it appears like this:
<Style ss:ID="s22"> <Borders> <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> <Border ss:Position="DiagonalLeft" ss:LineStyle="Continuous" ss:Weight="1"/> ...
I don’t know this library but I’ve seen that you can define cell’s borders using
XmlStyle class, specially setting the
XmlStyle sBorder = new XmlStyle(); sBorder.Border.Color = Color.Black; sBorder.Border.Weight = 1; sBorder.Border.LineStyle = Borderline.Continuous; sBorder.Border.Sides = BorderSides.DiagonalLeft; //<-- here where I'm not sure! //(I can't access the docs // right now to check that Enum) sheet[x, y].Style = sBorder;
thought may be this will help if you haven’t tried.