User (Legacy) Posted June 16, 2006 Report Share Posted June 16, 2006 Hello, I have the following C# code: MemoryStream stream = new MemoryStream(); chart1.Export(FileFormat.Xml, stream); stream.Seek(0, SeekOrigin.Begin); string xml = Encoding.UTF8.GetString(stream.GetBuffer()); Unfortunately, the first character of the xml string I get back has a trash ASCII 239 character before the ´<´ that begins the XML. I can trim this character if there, but is this a bug in the XML export ? I want to export the personalization data to XML and store myself. I will store the data as XML so Export to XML seemed natural. Would exporting to Binary and Base64 encoding be better - that is, be less likely to not Import successfully if I use an updated version of ChartFX in the future? Basically I´m trying to minimize the fragility of what I´m getting from ChartFX via the Export method. I don´t want to export data to find that in the future I can´t import it to ChartFX v9 or whatever. Thanks Mark Link to comment Share on other sites More sharing options...
Software FX Posted June 20, 2006 Report Share Posted June 20, 2006 That's the encoding code. The correct way to read that back into a string is: MemoryStream stream = new MemoryStream(); chart1.Export(FileFormat.Xml, stream); stream.Seek(0, SeekOrigin.Begin); TextReader reader = new StreamReader(stream); string xml = reader.ReadToEnd(); -- Francisco Padron www.chartfx.com Link to comment Share on other sites More sharing options...
mmuralidhar Posted August 20, 2009 Report Share Posted August 20, 2009 I am able to export to an xml file (code mentioned in the post) How do I import it back given an XML string ? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.