Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Visio cannot open exported file (Read 10996 times)
jlj30
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 183
Joined: Sep 4th, 2011
Visio cannot open exported file
Sep 9th, 2012 at 5:32pm
Print Post  
Hi,

I am getting an error when trying to open an exported Visio file.
No errors occur during the actual export; only when I try to open it with Visio 2003.  The text of the error message is:

"Visio is unable to open the XML file.  It does not contain valid XML.
File: xxx
Line, Column: 142,3
Error: Incorrect document syntax."

I have attached a zip file that contains the following:
- An XML export of the diagram
- A PDF export
- A VDX export
- A screenshot of the Visio error

Any suggestions?
This appears to be happening for all of my diagrams.

Thanks in advance.

Jim
  

Visio_Issue_-_XML_-_09Sep2012.zip (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Visio cannot open exported file
Reply #1 - Sep 10th, 2012 at 7:17am
Print Post  
Hi,

Apparently the VDX file has some web page content appended to it. The Visio XML markup ends at line 141 - you can see the closing </VisioDocument> tag there. Then starting from line 142 there is a DOCTYPE followed by a full html page code, including JavaScript from some Telerik controls inside. Check if this wasn't somehow pasted into the exporter's template file VisioExport.vxt, or otherwise some other code in your application might be appending it to the exported file.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
jlj30
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 183
Joined: Sep 4th, 2011
Re: Visio cannot open exported file
Reply #2 - Sep 10th, 2012 at 3:23pm
Print Post  
Hi Stoyan,

Thanks for the quick reply.
I looked more closely at the vdx file and you're right.
It appears that code from our Master page is appended to the Visio XML content.  But I'm confused how that could have gotten there.

Here is the code that generates the Visio export file.
As you can see, after calling your Export method, there is no further manipulation of the file.

Any thoughts?

Thanks

Jim

protected void Export2Visio()
    {
        Diagram diagram;
        string fullUrl = Request.Url.ToString();
        string hostUrl = fullUrl.Substring(0, fullUrl.LastIndexOf("/"));

        diagram = DiagramView1.Diagram;
        MindFusion.Diagramming.Export.VisioExporter visio = new MindFusion.Diagramming.Export.VisioExporter();
        visio.TemplatePath = Server.MapPath(@"~\Bin\visioExport.vxt");
        visio.ExportLanes = ExportLanes.Horizontal;
        visio.LaneGridTitle = Session["P_CFFD_CurrentActivityName"].ToString();

        String filename = CleanFileName(Session["P_CFFD_CurrentActivityName"].ToString()) + " - " + DateTime.Now.ToString("ddMMMyyyy-HHmm-ss") + ".vdx";
        visio.Export(diagram, Server.MapPath(@"~\ExternalDocs\") + filename);

        //
        // The following will cause the browser to open a dialog asking the user to Save, or potentially Open the file
        // The AppendHeader allows us to specify the filename without the leading server path info
        //
        Response.ContentType = "application/vnd.ms-visio";
        Response.AppendHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
        Response.TransmitFile(Server.MapPath(@"~\ExternalDocs\") + filename);
    }

  
Back to top
 
IP Logged
 
jlj30
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 183
Joined: Sep 4th, 2011
Re: Visio cannot open exported file
Reply #3 - Sep 10th, 2012 at 3:32pm
Print Post  
Hi,

One further note.
I did check the VisioExport.vxt file and it looks fine.
It ends properly with </VisioDocument>

Jim
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Visio cannot open exported file
Reply #4 - Sep 10th, 2012 at 3:41pm
Print Post  
If you open the exported file on the server file system, does it show the appended content? I suppose it is added at download time, if the aspx page whose Export2Visio method exports the file has a MasterPage attribute applied. In such case, try removing the attribute, or move the export method to a different page that doesn't load a master.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
jlj30
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 183
Joined: Sep 4th, 2011
Re: Visio cannot open exported file
Reply #5 - Sep 10th, 2012 at 5:39pm
Print Post  
Hi,

I just checked the file on the server and it DOES NOT contain the extra master page content.

Thanks for the prompt replies.

This is certainly strange, but it's not a MindFusion problem.

Jim
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint