2017-07-22 6 views
0

J'utilise le NPOI 2.0.6.0 et j'essaye de positionner une cellule VerticalAlign TOP et Centre.NPOI Alignement vertical et Centre

this._rowStyleLight.BorderRight = BorderStyle.Thin; 
this._rowStyleLight.FillPattern = FillPattern.SolidForeground; 
this._rowStyleLight.SetFillForegroundColor(this._rowColourLight); 
this._rowStyleLight.VerticalAlignment = VerticalAlignment.Top; 

Le VerticalAlignment ne l'offre pas. Quand je mets le _rowStyleLight.Alignment = HorizontalAlignment.Center; aussi au centre alors il semble que NPOI ne peut pas appliquer les deux.

Quelqu'un peut-il vous aider?

Répondre

0

essayer cette

XSSFFont yourFont = (XSSFFont)workbook.CreateFont(); 
yourFont.FontHeightInPoints = (short)10; 
yourFont.FontName = "Arial"; 

XSSFCellStyle yourStyle = (XSSFCellStyle)workbook.CreateCellStyle(); 
yourStyle.WrapText = true; 
yourStyle.Alignment = HorizontalAlignment.Left; 
yourStyle.VerticalAlignment = VerticalAlignment.Top; 
yourStyle.BorderBottom = BorderStyle.Thin; 
yourStyle.SetFont(yourFont); 

sheet.SetyourColumnStyle(col, yourStyle);