Clone


#1

Tommy,

Is there any rules when table can be cloned() and when not.

I am getting an exception error “reference is not set” when trying to clone 1 table but the others are ok.

The problematic one is defined in XML like the following:














tHANKS
Mark

#2

Dear mark,

Thanks for your consideration.

The bug has been fixed. Please down load hot fix 1.6.5 here.


#3

Tommy,

what is the difference between Clone() and CompleteClone().
Seems that CompleteClone() (which I assume cloning table with all rows and cells) still crushing.

Thanks
Mark


#4

Tommy,

even if I try to just clone table and than iterate and clone individual rows and cells
the software is crushing right and left.

here is the code:

Table srcTbl = (Table)s.Paragraphs[tblSrcName];

Table destTbl = (Table)srcTbl.Clone();

Table tableAfter = (Table)s.Paragraphs[insertAfterName];
s.Paragraphs.Insert(tableAfter, destTbl);

// copy rows
foreach (Row r in srcTbl.Rows)
{
Row nr = (Row)r.CompleteClone();
destTbl.Rows.Add(nr);

foreach(Cell c in r.Cells )
{
Cell nc = (Cell)c.CompleteClone();
nr.Cells.Add(nc);
}
}


1. CompleteClone is crushing
2. if just Clone() used than nr.Cells.Add(nc) than I am getting the following exception:
"The Table property must be set before adding a cell."




Also, does cell.Clone() cloming all segments used inside of cells?

I noticed that Paragraphs do not support Clone() method?


Tommy,
Is there any way we can chat on IM?
I hate to resolve 1 issue a day (since time difference).
I need to commit to some PDF software package since the deadline we have is may 19 and I am still nowhere close in selecting the software package to use.


Thanks
Mark










#5

Dear Tommy,

I have invited Mark to have a online meeting over MSN Messenger on the clone issue as well as other issues Mark is most concerned with. More info please check your email.

As Mark is very urgent, when you’re online please add Mark into your contact list then invite me to join the online chat.

Thanks in advance.


#6

Dear Mark,

Thanks for your consideration.

Row.CompleteClone() method clones all cells in the row. So you need not clone all cells any more. In your code I comment the following code and it works well:

// foreach(Cell c in r.Cells )
// {
// Cell nc = (Cell)c.CompleteClone();
// nr.Cells.Add(nc);
// }

If you still can’t get the CompleteClone() work, please send me a example which can reproduce the error.


#7

Dear Mark,

Thanks for your consideration.

The bugs in cloning is fixed and section cloning is now supported. Please download hot fix 1.6.6.

Please note:

1) Object ID will be changed when it is cloned. A suffix “-clone” is added. For example, if the original table’s ID is “Name”, the cloned table’s ID “Name-clone”. You can change the ID of cloned table to whatever you want.

2) Right alignment is not supported for Segment. You should right align the Text paragraph.