Merged cell borders

Dec 5, 2009 at 10:29 PM

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

Coordinator
Dec 12, 2009 at 2:54 AM

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

CellRangeAddress region = new CellRangeAddress(2, 4, 2, 4);
sheet.AddMergedRegion(region);

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 6:52 PM
Edited May 16, 2010 at 6:55 PM

Hi, tonyqus!

 

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

What should I be using to access it?

Thanks!

 

Got it!


Aug 11, 2010 at 3:04 PM

Hi c_iliescu,

Can you share where you got the HSSFRegionUtil class?

Thanks in advance

Aug 11, 2010 at 3:15 PM
Edited Aug 11, 2010 at 3: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.