Saving a shape within Visio

R

Russ McKenna

I tried a earlier post - no answers - Even though I answer many posts.

How can I save a shape in Visio, have that shape deleted, then recreate it
from Visio?

I thought of converting it to XML, save it under
Document.DocumentSheet.Cells(User.myShape), then when I need it, convert
Document.Documentsheet.Cells(User.myShape).formula back to a visible shape
on page x.

I can not hide the shape, because the page will be deleted. I need to beable
to save it Document.DocumentSheet.

Any thoughts.

Please
 
M

Markus Breugst

Hi Russ,

just for my own understanding: You want to store all the data of one of your
shapes within a single document property cell, using XML?

I do not know any Visio function that converts shape data to XML. Probably
you have to implement this by yourself by reading every shapesheet cell and
putting the name/value pair to a string.

But perhaps there are other possibilities, like creating a new (temporary)
page and copying the shape via automation to this page in order to save it?

Best regards,
Markus
 
S

soso

Could you elaborate on your question, please? Are you talking about
persistency (database or file for shape storage), or just about runtime
behavior (delete a shape, storing it somehow at runtime, and redraw the same
shape afterwards)?
 
R

Russ McKenna

I want to be able to recover a shape after it was deleted. Not all shapes,
just one in particular. It may not be recovered immediately (e.g. Undo),
just later in time. It is mainly because ot the text, format, etc. If it is
a major issue, then I will skip it, once deleted, it is gone.

Thought of saving to temp.xml, parsing out the shape, then saving the xml
data in a user.cell. When I need to recover shape, create a new shape, save
document as xml, replace shape with xml info, then reload the document. Also
thought about creating my own xml to store the info I need, and my own
import routine.

I have a place where the user can enter a lot of text. I want to save this
text and format if they delete the shape. Then recover if I need it.
 
S

soso

Sorry, from your answer I was unable to understand, if Visio application
could be unloaded and loaded again between a shape deletion. If so, you
definitely should use a file (XML or whatever) or DB as a persistent
storage, but I'm not sure that this is the case. Could you please specify,
if is required that the Visio application could be unloaded/loaded between
the shape deletion? If not so, you may be not required to use a persistent
storage.
 
R

Russ McKenna

Yes it will need to be persistent.

What I want it a way to convert a shape to XML and then save that XML data
within visio.document.documentsheet.cells("user.row1")

I don't want to create a hidden shape on a page, that page could be deleted.
Nor save it in a database, file, etc. I want it within that visio file.
 
M

Mai-lan [MS]

Hi, Russ: Sorry for the late reply, I just posted a response to your other question too. If your goal is specifically to save text and formatting, I'd use SolutionXML on the document level. Then the user can delete the page and you can still retrieve the text string information because your info is stored on the document.

You can build your own schema in SolutionXML to store text versus formatting from your shape and then have custom code that parses through your schema and copies it back to wherever you need to put it in a shape's ShapeSheet.

Thanks,
Mai-lan
 

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