dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: POI and setting cells to VerticalAlignment.MIDDLE

  1. #1
    Join Date
    Aug 2008
    Posts
    104

    Question POI and setting cells to VerticalAlignment.MIDDLE

    Hey all I am trying to get my cell to vertical line instead of just being aligned by the left side using POI.

    This is my java code:
    Code:
    static CellStyle headerCellStyle    = workbook.createCellStyle();
    
    headerCellStyle = workbook.createCellStyle();
    Row headerRow   = null;        
    sheet           = workbook.createSheet("String " + sheetname);
    
    headerCellStyle.setWrapText(true);
    headerCellStyle.setAlignment(HorizontalAlignment.LEFT);
    headerCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    headerCellStyle.setVerticalAlignment(VerticalAlignment.MIDDLE);
    
    // Create a Row
    headerRow   = sheet.createRow(0);
    However, the line headerCellStyle.setVerticalAlignment(VerticalAlignment.MIDDLE); has an error of:

    The method setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment) in the type CellStyle is not applicable for the arguments (org.apache.poi.sl.usermodel.VerticalAlignment)

    How can i go about getting this to work if I have already defined it as an static CellStyle headerCellStyle = workbook.createCellStyle();?

  2. #2
    Join Date
    Oct 2019
    Posts
    11

    Re: POI and setting cells to VerticalAlignment.MIDDLE

    There's nothing wrong with your code. Strange.. maybe that's some other problem...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)