Results 1 to 4 of 4

Thread: Read the formating of an excel column?

  1. #1

    Thread Starter
    Member
    Join Date
    May 2006
    Posts
    60

    Arrow Read the formating of an excel column?

    I'm having to read a spreadsheet, and depending on if the column is indented or not, store the value.

    If the field's formatting is indented, I ignore it, it if isn't, I store it.

    I read the field's value like this...
    VB Code:
    1. myVariable = exll.Worksheets(TabName).Cells(12, 1).Value.ToString

    But how can I read how the field is formatted??

    So it would end up something to the effect of ...
    VB Code:
    1. if ( exll.Worksheets(TabName).Cells(12, 1).FORMAT_IS_CORRECT ?? )then
    2.      myVariable = exll.Worksheets(TabName).Cells(12, 1).Value.ToString
    3. else
    4.      myVariable = "Skipped Value"
    5. End If

  2. #2
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Read the formating of an excel column?

    You cna look at the "AddIndent" property of the cell. If this property is TRUE, then the cell is indented, if FALSE it isn't.
    VB Code:
    1. If exll.Worksheets(TabName).Cells(12, 1).AddIndent = False Then
    2.      myVariable = exll.Worksheets(TabName).Cells(12, 1).Value.ToString
    3. Else
    4.      myVariable = "Skipped Value"
    5. End If
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  3. #3

    Thread Starter
    Member
    Join Date
    May 2006
    Posts
    60

    Re: Read the formating of an excel column?

    .AddIndent always returned false. I think it has to do with the way production formatted the spreadsheet, but I'm not sure.

    I'm using .IndentLevel and it is working well.

    I appreciate the help.

  4. #4
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Read the formating of an excel column?

    Hmmm, are you sure the cells are truely indentred, or could it be that they have leading spaces?
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width