TheSwamp

Code Red => .NET => Topic started by: nekitip on October 15, 2014, 05:24:53 AM

Title: embeded excel ole from side (external) database
Post by: nekitip on October 15, 2014, 05:24:53 AM
Has someone had a success in manipulating embeded OLE objects in side databases?
This is a side database:
http://spiderinnet1.typepad.com/blog/2013/03/autocad-net-read-dwg-into-memory-using-databasereaddwgfile.html (http://spiderinnet1.typepad.com/blog/2013/03/autocad-net-read-dwg-into-memory-using-databasereaddwgfile.html)

And this is how to open embeded excel objects:
http://forums.autodesk.com/t5/net/read-embedded-excel-sheet/td-p/3773610/page/2 (http://forums.autodesk.com/t5/net/read-embedded-excel-sheet/td-p/3773610/page/2)

But it appears that transaction cannot get OLE2FRAME object properly (half of its fields are empty) from side database. It feels like OLE object is not loaded at all.
Title: Re: embeded excel ole from side (external) database
Post by: nekitip on October 15, 2014, 07:45:54 AM
so, after loosing 8h with exploring all of the amazing depths of undocumented world of autocad, here are some of the starting points for someone who stumbles to this problem:
sulution to open OLE objects was found on some (russian?) forum,
http://adn-cis.org/forum/index.php?topic=721.0 (http://adn-cis.org/forum/index.php?topic=721.0)
and by google translating it, the soution they have is to use
Code - C#: [Select]
  1. Database destDb = new Database ( false , false) ;
this has to do with:
http://adndevblog.typepad.com/autocad/2012/07/using-readdwgfile-with-net-attachxref-or-objectarx-acdbattachxref.html (http://adndevblog.typepad.com/autocad/2012/07/using-readdwgfile-with-net-attachxref-or-objectarx-acdbattachxref.html)
however, you may find that now you have eNoInputFiler error
to solve this, you have to use document lock. But, since you do not have a document (you are, in fact, trying to open one!), you have to force the user to have at least one document
once he has one, any, you are able to do this:
http://adndevblog.typepad.com/autocad/2012/07/enoinputfiler-exception-when-using-readdwgfile.html (http://adndevblog.typepad.com/autocad/2012/07/enoinputfiler-exception-when-using-readdwgfile.html)
and then, open excel by combining
http://spiderinnet1.typepad.com/blog/2013/03/autocad-net-read-dwg-into-memory-using-databasereaddwgfile.html (http://spiderinnet1.typepad.com/blog/2013/03/autocad-net-read-dwg-into-memory-using-databasereaddwgfile.html)
and
http://forums.autodesk.com/t5/net/read-embedded-excel-sheet/td-p/3773610/page/2 (http://forums.autodesk.com/t5/net/read-embedded-excel-sheet/td-p/3773610/page/2)

This is the place where I will stop, and I have not tested this thoroughly. If anyone has something to contribute, please do.
Also, if someone writes this routine, it will be good for common routine thread.