Page Index Toggle Pages: 1 2 [3]  Send TopicPrint
Very Hot Topic (More than 25 Replies) visio import error (Read 22961 times)
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: visio import error
Reply #30 - Nov 8th, 2007 at 1:50pm
Print Post  
Try tracing the following code:

#import "MSXML6.dll" named_guids

bool File2String( LPCTSTR FileName, CString & FileContent )
{
     DWORD dwSize = 0, dwReadSize = 0;
     HANDLE hFile = NULL;
     HFILE hfOpened = NULL;
     OFSTRUCT oOfs;
     try
     {
           ZeroMemory(&oOfs, sizeof(oOfs));
           FileContent.Empty();

           hFile = (HANDLE) OpenFile(FileName, &oOfs, OF_READ);
           if (hFile!=INVALID_HANDLE_VALUE)
           {
                 dwSize = GetFileSize(hFile, NULL);
                 if ( dwSize == 0 )
                 {
                       CloseHandle(hFile);
                       return false;
                 }
                 ReadFile(hFile,FileContent.GetBuffer(dwSize),dwSize,&dwReadSize,NULL);
                 CloseHandle(hFile);

                 FileContent.GetBufferSetLength(dwSize);
           }
           else
           {
                 ATLTRACE("Error %i opening file: %s\n", GetLastError(), FileName);
                 return false;
           }
     }
     catch ( ... )
     {
           return false;
     }
     return true;
}

CString sXML;
File2String(path_to_your_vdx, sXML);

MSXML2::IXMLDOMDocument2Ptr m_xmldoc;
m_xmldoc.CreateInstance(MSXML2::CLSID_DOMDocument60);
VARIANT_BOOL success = m_xmldoc->loadXML((LPCTSTR) sXML);

Where does it fail?

Stoyan
  
Back to top
 
IP Logged
 
strong_peng
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 69
Joined: Jul 18th, 2007
Re: visio import error
Reply #31 - Nov 9th, 2007 at 7:30am
Print Post  

VARIANT_BOOL success = m_xmldoc->loadXML( sXML.AllocSysString());

report  error .

VARIANT_BOOL success = m_xmldoc->load("C:\\1.vdx");

is ok
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: visio import error
Reply #32 - Nov 9th, 2007 at 7:55am
Print Post  
Here is a version that loads the file using XmlDocument->Load:
https://mindfusion.org/_temp/FcxVisioImport2.zip

We used OpenFile in order to be able to load the file while it is opened in Visio. With that latest version that won't be possible, because XmlDocument->Load requires exclusive access to the file for some reason.

Stoyan
  
Back to top
 
IP Logged
 
strong_peng
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 69
Joined: Jul 18th, 2007
Re: visio import error
Reply #33 - Nov 9th, 2007 at 8:05am
Print Post  
I suggest  use the load with msxml3 and msxml6



  
Back to top
 
IP Logged
 
strong_peng
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 69
Joined: Jul 18th, 2007
Re: visio import error
Reply #34 - Nov 9th, 2007 at 8:13am
Print Post  
thanks a million. transfer ok, why so diffrense with source visio,
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: visio import error
Reply #35 - Nov 9th, 2007 at 11:05am
Print Post  
VisioImporter does not support custom Visio shapes, and it support only a few of the standard Visio shape palettes, e.g. Flowchart, Block Diagram, Organization Chart and Database. For other shapes, you can handle the BoxImported event and set the Shape or Picture of the imported box according to the VisioShapeName parameter.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 2 [3] 
Send TopicPrint