This project is read-only.

Merged cell borders

Dec 5, 2009 at 11:29 PM

How do I create a border around a  set of merged cells?

Dec 12, 2009 at 3:54 AM

HSSFSheet sheet = hssfworkbook.CreateSheet("new sheet");

CellRangeAddress region = new CellRangeAddress(2, 4, 2, 4);

short color = HSSFColor.RED.index;
CellBorderType borderType = CellBorderType.THIN;
            HSSFRegionUtil.SetRightBorderColor(color, region, sheet, hssfworkbook);
            HSSFRegionUtil.SetBorderRight(borderType, region, sheet, hssfworkbook);
            HSSFRegionUtil.SetLeftBorderColor(color, region, sheet, hssfworkbook);
            HSSFRegionUtil.SetBorderLeft(borderType, region, sheet, hssfworkbook);
            HSSFRegionUtil.SetTopBorderColor(color, region, sheet, hssfworkbook);
            HSSFRegionUtil.SetBorderTop(borderType, region, sheet, hssfworkbook);
            HSSFRegionUtil.SetBottomBorderColor(color, region, sheet, hssfworkbook);
            HSSFRegionUtil.SetBorderBottom(borderType, region, sheet, hssfworkbook);

May 16, 2010 at 7:52 PM
Edited May 16, 2010 at 7:55 PM

Hi, tonyqus!


Can you tell me where can I find this HSSFRegionUtil class?

What should I be using to access it?



Got it!

Aug 11, 2010 at 4:04 PM

Hi c_iliescu,

Can you share where you got the HSSFRegionUtil class?

Thanks in advance

Aug 11, 2010 at 4:15 PM
Edited Aug 11, 2010 at 4:16 PM

Hey I found it here

using NPOI.HSSF.UserModel.Contrib;


 For future use: To search for a class in namespace

  1. Place the cursor on the text 'class name' in your code window.
  2. Press and hold the keys Alt+Shift+F10.