2

I have created a function to read an excel sheet using OLEDb. I can make the connection and read the excel sheet.

With DbDataReader and a while loop using Read() method I retrieved all cell data from an excel sheet.

I want to check the alignment info of each cell. If a cell is left-aligned, I will pick data from those left-aligned cells.

How can I do that?

Sorry It is a stupid question but I really need it.

Thanks

Val Nolav
  • 908
  • 8
  • 19
  • 44
  • I'm not 100% sure, which is why I'm not putting it as an answer right now, but I'm pretty sure that OleDb won't give you that information. You need to go with the Excel InterOp assembly. – David Hoerster Jun 14 '11 at 01:17

1 Answers1

1

You can't do that with Excel OleDb provider; cell alignment isn't exposed. The OleDb provider makes the Excel spreadsheet mimic a database table and database columns don't have alignment.

You'll have to use Excel interop if you need to that. See this question for help on that.

Community
  • 1
  • 1
shf301
  • 31,086
  • 2
  • 52
  • 86