Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Fri Mar 08, 2019 10:58 am

hi,

i added a shape, for example a rect, and i can set the fill style. but how can i set the border style of the rect that i created, for example color and line style?

thanks.

flame1149
 
Posts: 6
Joined: Thu Mar 07, 2019 1:31 pm

Mon Mar 11, 2019 6:41 am

Hello,

Thanks for your inquiry.
Sorry that our Spire.XLS doesn't support setting the border style for a added shape at present. We will add it as a new feature into our upgrade list. If it can be achieved in the future, we will let you know.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Thu May 16, 2019 9:24 am

Hello,

Greetings from E-iceblue.
After further investigation, please try the following sample code to set border style for the added shape. If there is any question, just feel free to write back.
Code: Select all
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];
//Add a rect shape
IPrstGeomShape rect = sheet.PrstGeomShapes.AddPrstGeomShape(2, 2, 100, 100, PrstGeomShapeType.Rect);
XlsShape shape = rect as XlsShape;
//set the border style
shape.Line.ForeColor = Color.Red;
shape.Line.Weight = 8;
//save
workbook.SaveToFile("result.xlsx", ExcelVersion.Version2013);

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Fri May 24, 2019 8:22 am

Hello,

Greetings from E-iceblue.
Did my solution help you? Thanks in advance for your feedback and time.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Thu May 30, 2019 3:44 pm

Lisa.Li wrote:Hello,

Greetings from E-iceblue.
Did my solution help you? Thanks in advance for your feedback and time.

Sincerely,
Lisa
E-iceblue support team


Thanks a lots!

The code you provided help me a lot.

flame1149
 
Posts: 6
Joined: Thu Mar 07, 2019 1:31 pm

Fri May 31, 2019 1:37 am

Hello,

Glad to hear that! Just feel free to contact us if you need assistance in the future.
Have a nice day!

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.XLS