copying shape data to another shape

S

Scott

I need to copy the shape data from one shape to another. I've placed the
formula below in the appropriate loops to iterate through all of the cells in
each row in the section:

shpTo.CellsSRC(visSectionProp, ixRow, ixCol).FormulaForceU = _
shpFrom.CellsSRC(visSectionProp, ixRow, ixCol).FormulaU

A couple of questions:

1) Am I correct in assuming that I need to copy cell-by-cell and that I
cannot copy an entire row at once?

2) After I copy all the cells using the above formula is there anything else
I need to copy or set that is not in the rows?
 
M

Mark Nelson [MS]

Hi Scott,

Yes, you need to copy each cell individually. There are batch methods that
allow you to pass an array of cells and values at once - useful if
performance is a consideration. Look at GetFormulas and SetFormulas. Also
you have to set the Name and NameU properties of the new row to match the
one in the existing shape. That's all for Shape Data rows. When copying
other rows such as geometry, you would also have to set the row type.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

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

Scott

Thanks, Mark. I had wondered about Name and NameU but it seems that they are
set for me because I'm used AddNamedRow

retCode = shpTo.AddNamedRow(visSectionProp,
shpFrom.Section(visSectionProp).Row(ixRow).Name, visTagDefault)

Correct?
 
M

Mark Nelson [MS]

When you add a new row the Name and NameU are the same. However, you or a
user can change them independently after that. Since you said that you were
copying an existing Shape Data row, you should account for the fact that
Name and NameU may not match in the original. Add your new row using the
original NameU; then set the new Name property equal to the original Name
property.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

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

Scott

Good point -- thanks for the clarification.

Mark Nelson said:
When you add a new row the Name and NameU are the same. However, you or a
user can change them independently after that. Since you said that you were
copying an existing Shape Data row, you should account for the fact that
Name and NameU may not match in the original. Add your new row using the
original NameU; then set the new Name property equal to the original Name
property.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

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

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