Sep 26, 2009 at 12:11 AM

Impressive work - thanks for sharing!

Could you let me know how to use the NPOI.HSSF.Record.ExtendedFormatRecord.ShrinkToFit property? I can't find any way to be able to set it or apply it to a HSSFCell or HSSFCellStyle.


Sep 26, 2009 at 5:29 PM

I found a solution, it may have other consequences that I'm not aware of as I only started studying this project yesterday!

I've had to alter the NPOI.HSSF.UserModel.HSSFCellStyle class and add the following property implementation:

public bool ShrinkToFit
        return format.ShrinkToFit;
        // Not sure if this line is necessary
        format.IsIndentNotParentAlignment = (true);
        format.ShrinkToFit = (value);
        /* Not sure of the consequences of changing the XFType,
         * but shrink to fit only works on XF_CELL */
        format.XFType = ExtendedFormatRecord.XF_CELL;
Sep 27, 2009 at 12:45 PM

HSSFCellStyle should expose ShrinkToFit to users.

Sep 27, 2009 at 12:46 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.