Style by name?

Oct 11, 2012 at 10:33 AM
Edited Oct 11, 2012 at 10:33 AM

Hi,

is it possible to get existing user styles from an existing Excel document? I have a document where NumCellStyles is 63. I open it and I try this:

            _styles = new Hashtable();
            for (short i = 0; i < workbook.NumCellStyles; i++)
            {
var style = ((HSSFCellStyle)workbook.GetCellStyleAt(i));

                if (style.UserStyleName != null)
                {
                    _styles.Add(style.UserStyleName, style);
                }
            }

But I can't get the existing user styles (19). When I save the document all the user styles disappears...