This project has moved. For the latest updates, please go here.

Wrap text in formula cell

Nov 12, 2012 at 1:10 PM
Edited Nov 12, 2012 at 1:11 PM

Hello,

I couldn't replicate the following excel behaviour:

in a cell reference other cell with a long string, then set wrap text. the cell row adapts accordingly.

            var generated = new XLWorkbook();
            var workSheet = generated.AddWorksheet("Test");
            workSheet.Cell("B1").Style.Alignment.WrapText = true;
            workSheet.Cell("B1").Value = "hello hello hello hello hello";
            workSheet.Cell("A3").FormulaA1 = "B1";
            workSheet.Cell("A3").Style.Alignment.WrapText = true;
            generated.SaveAs("Generated.xlsx");

I also tried
workSheet.Cell("A3").Style.Alignment.SetWrapText(true);

but with no success...

Regards,

Diogo
Coordinator
Nov 14, 2012 at 5:44 PM

This one took a while to figure out.

Excel is actually cheating when you set the wrap text on a cell that points to another. It calculates the required height and then sets row height property. This is something I can't do here.

You'll have to do without.