Message-ID: <1078078794.9059.1711674717436.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_9058_279759611.1711674717436" ------=_Part_9058_279759611.1711674717436 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
If you set Prese=
rveStrings to true
, ExcelWriter will preserve numeric stri=
ngs as strings.
public boolean PreserveStrings{ get; set; }=20
Public Property PreserveStrings() As Boolean=20
By default, when populating template data markers, ExcelWriter tries to = convert numeric strings to numbers.
=20PreserveStrings
is a Read/Write property.<=
/p>=20
This property can be set for individual data markers using the Preserve data marker modifier.
=20ExcelTemplate xlt =3D new ExcelTemplate(); xlt.Open(@"C:\DataBinding\ArrayBindingTemplate.xls"); string[][] twodim =3D { new string[]{"Watertown", "MA", "02= 472"}, new string[]{"Washington","DC", "20= 500"} }; string[] names =3D {"City", "State", "Zi= p"}; xlt.BindData(twodim, names, "TwoDimArray", xlt.CreateDataBindingProperties()); xlt.PreserveStrings =3D true; xlt.Process(); xlt.Save(Page.Response, "ArrayBinding.xls", false);=20
Dim xlw As New ExcelTemplate() xlt.Open("C:\DataBinding\ArrayBindingTemplate.xls") Dim twodim As String()() =3D { _ New String(){"Watertown", "MA", "02= 472"}, _ New String(){"Washington", "DC", "2= 0500"}, _ } Dim names As String() =3D {"City", "State", &= quot;Zip"} xlt.BindData(twodim, _ names, _ "TwoDimArray", _ xlt.CreateDataBindingProperties()) xlt.PreserveStrings =3D True xlt.Process() xlt.Save(Page.Response, "ArrayBinding.xls", False)=20