none
Problem to get value RRS feed

  • Question

  • Hi,
    I do not get the value of cell.StyleIndex.Value, within the following codes
                                    WorksheetPart worksheetPart = (WorksheetPart)workbookPart.GetPartById(sheet.Id);
                                    WorkbookStylesPart wstylePart = workbookPart.WorkbookStylesPart;
                                    Stylesheet ss = wstylePart.Stylesheet;
    
                                    foreach (Cell cell in worksheetPart.Worksheet.Descendants<Cell>())
                                    {
                                        if (cell.StyleIndex != null)
                                        {
                                        ...


    against this file. Why?


    Many Thanks & Best Regards, Hua Min

    Friday, December 16, 2016 1:02 PM

Answers

  • Hi,

    When applying like Border/Fill/Font/Number Format, there is styleindex appended to cell nodes.

     

    For more information, please download Open XML Markup Explained from https://www.microsoft.com/en-us/download/details.aspx?id=15359

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Monday, December 19, 2016 11:50 AM
    Moderator

All replies

  • Hi,

    The code is fine. The possible reason you did not get Styleindex value of the cell is that there is no styleindex appended. Meaning you did not set its style. Please confirm the cell is formatted.


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, December 19, 2016 7:49 AM
    Moderator
  • Thanks. Which specific format of the cell is affecting value of StyleIndex?

    Many Thanks & Best Regards, Hua Min

    Monday, December 19, 2016 8:06 AM
  • Hi,

    When applying like Border/Fill/Font/Number Format, there is styleindex appended to cell nodes.

     

    For more information, please download Open XML Markup Explained from https://www.microsoft.com/en-us/download/details.aspx?id=15359

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Monday, December 19, 2016 11:50 AM
    Moderator
  • Hi,

    If you have any issue for the original question, please let me know.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, December 28, 2016 9:12 AM
    Moderator