Print Page | Close Window

Can't open file with XmlParts

Printed From: TMS Software
Category: .NET Components
Forum Name: .NET Flexcel
Forum Discription:
URL: http://www.tmssoftware.com/site/forum/forum_posts.asp?TID=7422
Printed Date: 16 Nov 2019 at 10:10pm


Topic: Can't open file with XmlParts
Posted By: Ghislain Benrais
Subject: Can't open file with XmlParts
Date Posted: 26 Jan 2017 at 3:40pm
Hello,
I save some custom xml parts in excel files with this program :
        public  void SaveContent(string xml )
        {
            try
            {
                TCustomXmlPart xmlPart = new TCustomXmlPart(xml,null);
                _xlsFile.AddCustomXmlPart(xmlPart);
            }
            catch (Exception e)
            {
                throw new Exception("Erreur lors de la sauvegarde des donn?es dans un document FlexCel :" + "\n" + e.Message);
            }
        }

It works fine but when I open the saved file with this program :
            Xls = new XlsFile();
            Xls.Open(fileName);

I get the an XmlException :
Unexpected XML declaration. The XML declaration must be the first node in the document, and no white space characters are allowed to appear before it. Line 1, position 41
Here are the first bytes of the xml part (I stripped the null characters) :
<?xml version="1.0" encoding="utf-16"?><Document xmlns:d1="http://www.w3.org/2001/XMLSchema" xmlns:d2="http://sch...
I noticed that BOM was missing, so I tried again with it and got the same exception.
Thanks for your help,
Ghislain







Replies:
Posted By: Adrian Gallero
Date Posted: 26 Jan 2017 at 4:49pm
Thanks for reporting this: It is indeed a bug on FlexCel side.
We will be releasing a new version later today that will have this fixed.


Posted By: Adrian Gallero
Date Posted: 01 Feb 2017 at 4:26pm
Ok, the new version took a little longer than planned due to all changes Microsoft did in .NET core (now it is csproj based, not project.json based).
But the new version is already available on our site.


Posted By: Ghislain Benrais
Date Posted: 01 Feb 2017 at 4:41pm

Thanks a lot



Print Page | Close Window