Message-ID: <18929389.8961.1711669444073.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_8960_948589131.1711669444073" ------=_Part_8960_948589131.1711669444073 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Table of Contents | =20
---|
=20 |
What might cause this to happen:
=20/* INCORRECT CODE: ExcelTemplate xlt =3D new ExcelTemplate(); xlt.Open(Page.MapPath(@"path\to\code.xlsx")); /*...*/ xlt.Process(); ExcelApplication xla =3D new ExcelTemplate(); Workbook wb =3D xla.Open(xlt); xla.Save(wb, "Completed.xlsx"); */=20
Why this method causes issues:
=20Solutions:
=20// POSSIBLE CORRECT CODE: ExcelApplication xla =3D new ExcelApplication(); Workbook wb =3D xla.Open(Page.MapPath(@"path\to\code.xlsx")); /*...*/ ExcelTemplate xlt =3D new ExcelTemplate(); xlt.Open(xla, wb); xlt.Process(); xlt.Save(Page.Response, "Completed.xlsx", false);=20
What might cause this to happen:
=20/* INCORRECT CODE: Area testArea =3D ws.CreateArea(1,1,75,75); // If the entire area is not populated with data, then this results in empt= y cells being created, // as they are a part of the area. */=20
Why this method causes issues:
=20Solutions:
=20// POSSIBLE CORRECT CODE: Area testArea =3D ws.CreateArea(1,1,20,4); // Create areas that are as accurately sized to the data as possible, as op= posed to vastly overscaled.=20
What might cause this to happen:
=20Why this method causes issues:
=20Solutions:
=20What might cause this to happen:
=20/* INCORRECT CODE: Style randDataStyle =3D wb.CreateStyle(); randDataStyle.BackgroundColor =3D wb.Palette.GetClosestColor(162, 221, 139)= ; randDataStyle.HorizontalAlignment =3D Style.HAlign.Center; ColumnProperties columnProperties; System.Random rand =3D new System.Random(); for (int iRow =3D 1; iRow < 50; iRow++) { for (int iCol =3D 0; iCol < 3; iCol++) { ws.Cells[iRow, iCol].Value =3D rand.Next(100); ws.Cells[iRow, iCol].ApplyStyle(randDataStyle); } } */=20
Why this method causes issues:
=20Solutions:
=20// POSSIBLE CORRECT CODE: Style randDataStyle =3D wb.CreateStyle(); randDataStyle.BackgroundColor =3D wb.Palette.GetClosestColor(162, 221, 139)= ; randDataStyle.HorizontalAlignment =3D Style.HAlign.Center; ColumnProperties columnProperties; // Loop through the 2-4 columns to apply formatting for (int i =3D 1; i < 4; i++) { columnProperties =3D ws.GetColumnProperties(i); columnProperties.Width =3D 100; columnProperties.ApplyStyle(randDataStyle); }=20
What might cause this to happen:
=20Why this method causes issues:
=20Solutions:
=20