9
Próbowałem kilkunastu sposobów, aby to zrobić i nic nie działa. Próbuję zastosować pionowe wyrównanie do środka.NPOI pionowe centrum wyrównania
Nic nie działa.
Naprawdę doceniam pomoc.
Oto mój kod:
var workbook = new HSSFWorkbook();
var sheet = workbook.CreateSheet("Zmiana " + i.ToString());
var headerRow = sheet.CreateRow(0);
headerRow.CreateCell(0).SetCellValue("Data");
headerRow.CreateCell(1).SetCellValue("Maszyna");
headerRow.CreateCell(2).SetCellValue("Zmiana");
headerRow.CreateCell(3).SetCellValue("Brygadzista");
int rowNumber = 1;
List<MachineStatusReport> listForOneShift = list.Where(c => c.Zmiana == i).ToList();
foreach (MachineStatusReport elements in listForOneShift)
{
var row = sheet.CreateRow(rowNumber++);
row.CreateCell(0).SetCellValue(date.ToShortDateString());
row.CreateCell(1).SetCellValue(elements.Stanowisko);
row.CreateCell(2).SetCellValue("Zmiana " + i.ToString());
row.CreateCell(3).SetCellValue(elements.Brygadzista);
row.CreateCell(4).SetCellValue(elements.KodProduktu);
}
NPOI.SS.Util.CellRangeAddress cra = new NPOI.SS.Util.CellRangeAddress(1, counter, 1, 5);
sheet.AddMergedRegion(cra);
}
MemoryStream output = new MemoryStream();
workbook.Write(output);
Cheers!
której wersji NPOI używasz? –
@WordyFox 2.1.1 –
Czy kiedykolwiek znalazłeś rozwiązanie? –