import .xls file cell borders always ExcelLineStyle.None
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
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
SIGN IN To post a reply.
7 Replies
SD
Sarathi D
Syncfusion Team
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,
Sarathi
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
KD
Konrad Delong
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?
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?
SD
Sarathi D
Syncfusion Team
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
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
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
KD
Konrad Delong
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
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
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
KD
Konrad Delong
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.
FormatRead.zip
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
KD
Konrad Delong
August 29, 2007 02:58 PM UTC
It was our mistake. Sorry for that. "Worksheet.Cells" works fine.
SD
Sarathi D
Syncfusion Team
September 4, 2007 11:34 PM UTC
Hi Jonathan,
Thank you for the update. Please let me know if you have any further queries.
Regards,
Sarathi
Thank you for the update. Please let me know if you have any further queries.
Regards,
Sarathi
SIGN IN To post a reply.
- 7 Replies
- 3 Participants
-
JH Jonathan Hartley
- Aug 24, 2007 10:52 AM UTC
- Sep 4, 2007 11:34 PM UTC