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.

Mon Jan 29, 2018 1:22 pm

Hello

Please take a look at attached file, cells F1 and F2. There is one diagonal border available, but style.borders shows both of diagonal borders available. please check.

EDIT:
In the same file, please check the "DisplayedText" of cell D1. It must be empty but this is showing value of 3.

Using version 7.12.144

Thanks
Attachments
DB84080A-8AB9-49AB-A607-0367D6A7F73ABook1.rar
(25.23 KiB) Downloaded 242 times

ahmadi_rad@yahoo.com
 
Posts: 43
Joined: Thu Apr 13, 2017 3:53 pm

Tue Jan 30, 2018 2:55 am

Hello ahmadi_rad@yahoo.com,

Thanks for your inquiry.
Please use the below code to get the border information rather than simply from "style.borders", and you will get the correct result.
Code: Select all
var workbook = new Workbook();
workbook.LoadFromFile(path);
var worksheet = workbook.Worksheets[0];
bool ifdiaF1 = worksheet.Range["F1"].Borders[BordersLineType.DiagonalDown].ShowDiagonalLine;
bool ifdiaF2 = worksheet.Range["F2"].Borders[BordersLineType.DiagonalUp].ShowDiagonalLine;

//Judge if there's border on the four sides, eg, left.
bool isB1WithLeftborder = false;
var left = worksheet.Range["B1"].Borders[BordersLineType.EdgeLeft];
if (left!=null &&left.LineStyle != LineStyleType.None)
{
    isB1WithLeftborder = true;
}
string D1Text = worksheet.Range["D1"].DisplayedText;


In addition, the property "DisplayedText" returns "" at my end. Please check twice or you could add the code snippet at the foremost of the code to try again.
Code: Select all
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;


If the issue still exists, please share your testing environment in detail to help us reproduce the case.

Sincerely,
Jane
E-iceblue support team
Attachments
D1.png
D1.png (18.49 KiB) Viewed 2454 times
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Tue Jan 30, 2018 9:41 pm

Hello and thanks for your answer.
Your answer to my first question was helpful.
About second problem:
Please look at my screenshot attached.
Debug.rar
(18.82 KiB) Downloaded 235 times

About adding your snippet: I'm not sure where to add that code because the code is meant to be running in a cascade of dlls and appdomains.

ahmadi_rad@yahoo.com
 
Posts: 43
Joined: Thu Apr 13, 2017 3:53 pm

Wed Jan 31, 2018 6:40 am

Hello,

Thanks for your valuable feedback.
Let's put the thread culture aside for a time, we need to identify the root of the issue first.
I have created a sample project on my end, please run it directly and tell us the result you got.
Project download link: http://www.e-iceblue.com/downloads/attachment/12765.zip

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Thu Feb 01, 2018 3:19 am

Hello and thanks for the sample project. Unfortunately it did not reproduce the error.

ahmadi_rad@yahoo.com
 
Posts: 43
Joined: Thu Apr 13, 2017 3:53 pm

Thu Feb 01, 2018 3:45 am

For your reference: Excel file saved after operation of spire package looks like this.
Attachments
test.rar
(28.53 KiB) Downloaded 241 times

ahmadi_rad@yahoo.com
 
Posts: 43
Joined: Thu Apr 13, 2017 3:53 pm

Thu Feb 01, 2018 8:05 am

Hello,

Thanks for your valuable feedback.
I noticed that you had edited the file, such as adding the comments. If you couldn't reproduce the issue with the demo I provided before, the error must be related to the operation you made. Therefore, could you please send the completed code to us(support@e-iceblue.com) to demonstrate what you had done.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Return to Spire.XLS