How to store a large block of binary data in each shape

M

Muru

Hi
I'm programming for a project which extends Visio's functionalities and provides a customized Visio solution. I'm faced with a situation where I have to store a big chunk of binary data(potentially MBs in size) to every shape in a drawing. When the drawing gets stored as .vsd file, the data also should be saved as part of the drawing.
It would be of great help if someone could provide an idea
Thanks in advance
Mur
Software Consultan
 
M

Mark Nelson [MS]

Visio supports SolutionXML in the document and at a shape level. There
really is no way to attached a binary blob to a shape. Given your potential
size of data, that doesn't sound like a reasonable approach anyway. Store
the binary information somewhere else and put a reference to it in the
shape. If you must include the data with the drawing, one option that
others have used is to write an ActiveX control that can store your data and
place that control on one of your Visio pages.

--
Mark Nelson
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.


Muru said:
Hi,
I'm programming for a project which extends Visio's functionalities and
provides a customized Visio solution. I'm faced with a situation where I
have to store a big chunk of binary data(potentially MBs in size) to every
shape in a drawing. When the drawing gets stored as .vsd file, the data also
should be saved as part of the drawing.
 
M

Muru

Hello Mark Nelson,
Thank you very much for your reply.

1) I did explore SolutionXML possibilities but found that it is not suitable
for my requirements.

2) In the second approach, if I were to develop an ActiveX control to store
the data, how exactly can I go about implementing it? How that ActiveX
control writes the data to the drawing document? And also, how the ActiveX
control re-instantiated, gains access to the data when the drawing document
is opened at a later time?

There seems to be an XML tag (VisioShape's property) called
<ForeignData>, which is used to store block of binary data. But how it is
achieved looks mystery to me. I couldn't find any documentation or sample
code piece which addresses this area.

Please, help me if you can. A high level overview of (2) can be a great help
to me.
Thank you.
Muru


----- Mark Nelson [MS] wrote: -----

Visio supports SolutionXML in the document and at a shape level. There
really is no way to attached a binary blob to a shape. Given your potential
size of data, that doesn't sound like a reasonable approach anyway. Store
the binary information somewhere else and put a reference to it in the
shape. If you must include the data with the drawing, one option that
others have used is to write an ActiveX control that can store your data and
place that control on one of your Visio pages.

--
Mark Nelson
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.


Muru said:
Hi,
I'm programming for a project which extends Visio's functionalities and
provides a customized Visio solution. I'm faced with a situation where I
have to store a big chunk of binary data(potentially MBs in size) to every
shape in a drawing. When the drawing gets stored as .vsd file, the data also
should be saved as part of the drawing.
 
M

Mark Nelson [MS]

I don't have much more detailed information to provide. I'm just aware that
the technique has been used by developers in the past. My guess is that
this is fairly similar to embedding an OLE object in the document. The
object has its own storage associated with it.

Foreign data is used for foreign object types such as Ink, Pictures or OLE
objects. If you were to place an ActiveX control on the page, Visio would
create a shape of type foreign object to wrap the control. The ActiveX
information would then be stored under this tag, if the document is stored
as XML.

--
Mark Nelson
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.


Muru said:
Hello Mark Nelson,
Thank you very much for your reply.

1) I did explore SolutionXML possibilities but found that it is not suitable
for my requirements.

2) In the second approach, if I were to develop an ActiveX control to store
the data, how exactly can I go about implementing it? How that ActiveX
control writes the data to the drawing document? And also, how the ActiveX
control re-instantiated, gains access to the data when the drawing document
is opened at a later time?

There seems to be an XML tag (VisioShape's property) called
<ForeignData>, which is used to store block of binary data. But how it is
achieved looks mystery to me. I couldn't find any documentation or sample
code piece which addresses this area.

Please, help me if you can. A high level overview of (2) can be a great help
to me.
Thank you.
Muru


----- Mark Nelson [MS] wrote: -----

Visio supports SolutionXML in the document and at a shape level. There
really is no way to attached a binary blob to a shape. Given your potential
size of data, that doesn't sound like a reasonable approach anyway. Store
the binary information somewhere else and put a reference to it in the
shape. If you must include the data with the drawing, one option that
others have used is to write an ActiveX control that can store your data and
place that control on one of your Visio pages.

--
Mark Nelson
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.


Muru said:
Hi,
I'm programming for a project which extends Visio's functionalities
and
provides a customized Visio solution. I'm faced with a situation where I
have to store a big chunk of binary data(potentially MBs in size) to every
shape in a drawing. When the drawing gets stored as .vsd file, the data also
should be saved as part of the drawing.
It would be of great help if someone could provide an idea.
Thanks in advance,
Muru
Software Consultant
 
M

Muru

Thank you so much for your quick reply. I'll try experimenting with ActiveX control approach.
Thank you.
Muru


----- Mark Nelson [MS] wrote: -----

I don't have much more detailed information to provide. I'm just aware that
the technique has been used by developers in the past. My guess is that
this is fairly similar to embedding an OLE object in the document. The
object has its own storage associated with it.

Foreign data is used for foreign object types such as Ink, Pictures or OLE
objects. If you were to place an ActiveX control on the page, Visio would
create a shape of type foreign object to wrap the control. The ActiveX
information would then be stored under this tag, if the document is stored
as XML.

--
Mark Nelson
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.


Muru said:
Hello Mark Nelson,
Thank you very much for your reply.
1) I did explore SolutionXML possibilities but found that it is not
suitable
for my requirements.
2) In the second approach, if I were to develop an ActiveX control to
store
the data, how exactly can I go about implementing it? How that ActiveX
control writes the data to the drawing document? And also, how the ActiveX
control re-instantiated, gains access to the data when the drawing document
is opened at a later time?
There seems to be an XML tag (VisioShape's property) called
<ForeignData>, which is used to store block of binary data. But how it is
achieved looks mystery to me. I couldn't find any documentation or sample
code piece which addresses this area.
Please, help me if you can. A high level overview of (2) can be a great
help
to me.
Thank you.
Muru
----- Mark Nelson [MS] wrote: -----
Visio supports SolutionXML in the document and at a shape level.
There
really is no way to attached a binary blob to a shape. Given your potential
size of data, that doesn't sound like a reasonable approach anyway. Store
the binary information somewhere else and put a reference to it in the
shape. If you must include the data with the drawing, one option that
others have used is to write an ActiveX control that can store your data and
place that control on one of your Visio pages.
Mark Nelson
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights. Hi,
I'm programming for a project which extends Visio's functionalities
and
provides a customized Visio solution. I'm faced with a situation where I
have to store a big chunk of binary data(potentially MBs in size) to every
shape in a drawing. When the drawing gets stored as .vsd file, the data also
should be saved as part of the drawing.
It would be of great help if someone could provide an idea.
Thanks in advance,
Muru
Software Consultant
 
M

Michael Murphy

Hi Muru

I have just implimented similar functionality in my app. I encoded the file
and stored it in the SolutionXML element. I created a guid and stored it
the a user-defined cell. I then used the guid as the name of the
SolutionXMl file. The text of the SolutionXML element is the encoded data.

'// Read file
Dim s As IO.StreamReader = New IO.StreamReader(FilePath)
'// read stream as binary reader
Dim b As New IO.BinaryReader(s.BaseStream)
'// create xmltextwriter
Dim x As Xml.XmlTextWriter = New Xml.XmlTextWriter(xmlSW)
'write stream to string writer
x.WriteBase64(b.ReadBytes(b.BaseStream.Length), 0, b.BaseStream.Length)


_VisioDoc.SolutionXMLElement(fileguid) = x.tostring
Aside from Visio using alot of memory when accessign the info, it seems to
work ok so far. Its still in testing.
Mike Murphy

Muru said:
Thank you so much for your quick reply. I'll try experimenting with ActiveX control approach.
Thank you.
Muru


----- Mark Nelson [MS] wrote: -----

I don't have much more detailed information to provide. I'm just aware that
the technique has been used by developers in the past. My guess is that
this is fairly similar to embedding an OLE object in the document. The
object has its own storage associated with it.

Foreign data is used for foreign object types such as Ink, Pictures or OLE
objects. If you were to place an ActiveX control on the page, Visio would
create a shape of type foreign object to wrap the control. The ActiveX
information would then be stored under this tag, if the document is stored
as XML.

--
Mark Nelson
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.


Muru said:
Hello Mark Nelson,
Thank you very much for your reply.
not
suitable
for my requirements.
to
store
the data, how exactly can I go about implementing it? How that ActiveX
control writes the data to the drawing document? And also, how the ActiveX
control re-instantiated, gains access to the data when the drawing document
is opened at a later time?
<ForeignData>, which is used to store block of binary data. But how it is
achieved looks mystery to me. I couldn't find any documentation or sample
code piece which addresses this area.
great
help
to me.
Thank you.
Muru
----- Mark Nelson [MS] wrote: -----
Visio supports SolutionXML in the document and at a shape
level.
There
really is no way to attached a binary blob to a shape. Given
your
potential
size of data, that doesn't sound like a reasonable approach
anyway.
Store
the binary information somewhere else and put a reference to
it in
the
shape. If you must include the data with the drawing, one
option
that
others have used is to write an ActiveX control that can store
your
data and
place that control on one of your Visio pages.
Mark Nelson
Microsoft Corporation
confers no
rights.
functionalities
and
provides a customized Visio solution. I'm faced with a
situation
where I
have to store a big chunk of binary data(potentially MBs in
size) to
every
shape in a drawing. When the drawing gets stored as .vsd file,
the
data also
should be saved as part of the drawing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top