XmlTextWriter and whitespace

Discussion in 'ASP .Net' started by st, Oct 6, 2005.

  1. st

    st Guest

    Hi,

    I've a routine that exports a DB query to Excel by building an
    XmlDocument and saving to a XmlTextWriter.

    The function works but new lines don't show up, i.e. significant
    whitespace is cut. I've tried adding WriteAttributeString("xml",
    "space", null, "preserve") to the XmlTextWriter just prior to save, but
    that results in the error: "Index was outside the bounds of the array."

    Can anyone assist?

    Many thanks,

    Simon Lane
     
    st, Oct 6, 2005
    #1
    1. Advertisements

  2. st

    Scott Allen Guest

    Hi Simon:

    Have you tried setting the PreserveWhitespace property on your
    XmlDocument object to true?
     
    Scott Allen, Oct 6, 2005
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.