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.

Thu Apr 09, 2020 2:03 pm

Hi Support Team,

do you have any sample code how to set / remove border for Textboxes and Pictures (Images)?

Worksheet destinationSheet = workbook.Worksheets[0];
var textBox = destinationSheet.TextBoxes.AddTextBox(1, 1, 100,100);

var picture = destinationSheet.Pictures.Add(1, 1, "MyImage.png");


best regards
Christian

PrintPro
 
Posts: 55
Joined: Tue Apr 16, 2019 6:17 pm

Fri Apr 10, 2020 7:09 am

Hello,

Thanks for your inquiry.
Please refer to the below code to set/remove border for text box. As for the picture border, I did an initial test but found using the similar code to set/remove border for pictures didn't work. This issue has been posted to our Dev team with the ticket SPIREXLS-2254 for further investigation and fixing. Once it is fixed, we will let you know.
Code: Select all
    Workbook workbook = new Workbook();
    Worksheet destinationSheet = workbook.Worksheets[0];
    //Add text box
    XlsTextBoxShape textBox = destinationSheet.TextBoxes.AddTextBox(1, 1, 100, 100) as XlsTextBoxShape;
    //Set border color and weight
    textBox.Line.ForeKnownColor = ExcelColors.Red;
    textBox.Line.Weight = 2;

    ////Remove border
    //textBox.Line.Weight = 0;

    workbook.SaveToFile("result.xlsx", FileFormat.Version2013);


Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Fri Apr 10, 2020 8:33 am

Dear Rachel,

thx, for your qick response!

"as XlsTextBoxShape" did the trick...

Waiting for the Picture issues fix.

kind gegards Christian

PrintPro
 
Posts: 55
Joined: Tue Apr 16, 2019 6:17 pm

Fri Apr 10, 2020 10:29 am

Hello,

Thanks for your response.
Once the fix of the issue SPIREXLS-2254 is avaiable, we will inform you asap.
Have a nice day!

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Wed Jan 20, 2021 8:29 am

Hello,

Hope you are doing well.
I just got news from our Dev team that the issue SPIREXLS-2254 has been fixed. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Wed Jan 20, 2021 9:07 am

Hello Rachel,

good news! I hope this will be fixed in Spire.Office because since we use multiple of your products in one project we are forced to use Spire.Office

thanks for your support
regards Christian

PrintPro
 
Posts: 55
Joined: Tue Apr 16, 2019 6:17 pm

Wed Jan 20, 2021 9:13 am

Hi Christian,

Okay, I will inform you when the new version of Spire.Office is released. Thanks for your patience.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Mon Jan 25, 2021 6:48 am

Hi Christian,

Hope you are doing well.
Glad to inform you that the new version of Spire.Office is released. Welcome to download it from the following links.
Website link: https://www.e-iceblue.com/Download/down ... t-now.html
Nuget link: https://www.nuget.org/packages/Spire.Office/6.1.0

Code example:
Code: Select all
//Add border
picture.Line.Weight = 2;

//Remove border
picture.Line.Visible = false
////or
//picture.Line.Weight = 0;


Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Fri Feb 12, 2021 6:16 am

Hello Rachel,

tested and integrated - it is fixed now and works! Thanks Christian

PrintPro
 
Posts: 55
Joined: Tue Apr 16, 2019 6:17 pm

Fri Feb 12, 2021 9:33 am

Hello Christian,

Thanks for your feebback.
Glad to hear that your issue has been solved.
Feel free to contact us if you have any issues in the future.

Sincerely
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.XLS