We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

import .xls file cell borders always ExcelLineStyle.None

Thread ID:





67596 Aug 24,2007 10:52 AM UTC Sep 4,2007 11:34 PM UTC WinForms 7
Tags: XlsIO
Jonathan Hartley
Asked On August 24, 2007 10:52 AM UTC

I have a saved Excel .xls file. I import it and am attempting to read the cell borders using:


These linestyles always come back as ExcelLineStyle.None, even though the .xls file being imported contains:

1 cell with top border set
1 cell with left border set
1 cell with bottom border set
1 cell with right border set

(where 'set' means 1pixel black continuous)

Is there anything else I should be trying? Has anyone else seen this? Thanks.


Sarathi D [Syncfusion]
Replied On August 24, 2007 09:52 PM UTC

Hi Jonathan,

I tried to reproduce this problem in http://websamples.syncfusion.com/samples/XlsIO.Windows/67596/main.htm
, and could not see it. When I get the cellborder for the cell using your code, it shows correct cellborder information in a MessageBox.

Can you send a sample showing the problem, or modify the attached sample to show the problem? Or, somehow provide more information so we can track down this problem?

Best Regards,

Konrad Delong
Replied On August 28, 2007 11:42 AM UTC

You're right, the traits are being set correctly on the cells. That turned out not to be the problem.

What causes the issue is iterating over worksheet.Cells - it doesn't return cells with formatting only (e.g. border set but empty values). How should we handle this problem when importing Excel sheets which contain empty cells with formatting?

Sarathi D [Syncfusion]
Replied On August 28, 2007 09:44 PM UTC

Hi Jonathan,

Thank you for the details provided.

I am afraid that again I am not able to reproduce the issue. Here are the steps that I have followed to reproduce the issue.

Reproduce Steps:

1. Applied border styles to the cells with no text in the cells.
2. Iterated over the cells and read the borders.

I have attached the sample which I have worked. Sample is available here


Please have a look at the above sample and if still the issue exists, could you please try reproducing it
in the above sample or send us the reproducing steps so that we could sort out the cause of the issue
and provide you a solution?

Sorry for the inconvenience.


Konrad Delong
Replied On August 29, 2007 10:38 AM UTC

Format string may contain up to 4 sections defining formatting for positive, negative, zero and text data. What's more: they can describe date, time and fraction formatting. It's a legacy excel feature of course, but unfortunately many excel documents take advantage of this, which means that we cannot simply take the length of format string and subtract 2.

Some examples of valid format strings:

General <- yes, this one too

Hope the attached example will be of some help.


Konrad Delong
Replied On August 29, 2007 11:09 AM UTC

As in attached example: sheet.Cells doesn't iterate over all cells. For some mysterious reason this time it found the empty cell and didn't see the cell with value.

What we need is a way of finding all interesting cells in a worksheet (that means: those including value or formatting of some kind). That was the reason of previous issue.


Konrad Delong
Replied On August 29, 2007 02:58 PM UTC

It was our mistake. Sorry for that. "Worksheet.Cells" works fine.

Sarathi D [Syncfusion]
Replied On September 4, 2007 11:34 PM UTC

Hi Jonathan,

Thank you for the update. Please let me know if you have any further queries.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon