kan-qiu

kan-qiu

  • NA
  • 1
  • 0

transform xml to excel using xslt

Jan 11 2005 2:56 PM
I am using xslt to tranform data to Excel and CSV file(for user to download data), it is fine to transform data to CSV, but when I transform data to excel, some fields that with numeric value like 000123 were truncated to 123. I don't want hose Leading zeros were truncated but I don't know how to control that. Here is part of the code for(int i=0; i< sFields.Length; i++) { writer.WriteString("\""); writer.WriteStartElement("xsl:value-of"); writer.WriteAttributeString("select", sFields[i]); writer.WriteEndElement( ); // xsl:value-of writer.WriteString("\""); if (i != sFields.Length - 1) writer.WriteString( (fileType == FileType.CSV ) ? "," : " " ); }