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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

import .xls file cell borders always ExcelLineStyle.None

Thread ID:

Created:

Updated:

Platform:

Replies:

67596 Aug 24,2007 06:52 AM Sep 4,2007 07:34 PM Windows Forms 7
loading
Tags: XlsIO
Jonathan Hartley
Asked On August 24, 2007 06:52 AM

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

cell.CellStyle.Borders[ExcelBordersIndex.EdgeBottom].LineStyle

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.

Jonathan

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

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,
Sarathi

Konrad Delong
Replied On August 28, 2007 07:42 AM

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 05:44 PM

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

http://websamples.syncfusion.com/samples/XlsIO.Windows/67596/main.htm


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.


Regards,
Sarathi

Konrad Delong
Replied On August 29, 2007 06:38 AM

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
0.000
0.000;[Red]-0.00
0.000;[Red]-0.00;[Blue]"ZERO!"
0.000;[Red]-0.00;[Blue]"ZERO!";"text:"_@

Hope the attached example will be of some help.

DecimalRead.zip

Konrad Delong
Replied On August 29, 2007 07:09 AM

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.

FormatRead.zip

Konrad Delong
Replied On August 29, 2007 10:58 AM

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

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

Hi Jonathan,

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

Regards,
Sarathi

CONFIRMATION

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.

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

;