M
Mystery Man
I have a situation where I create a table programmatically. I now want
to set the format of this table based on another table.
I have code similar to the following:
object oformat = (object)oldTable.AutoFormatType;
newTable.AutoFormat(ref oformat, ref oMissing, ref oMissing, ref
oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref
oMissing, ref oMissing);
As you can see, getting the format type of the old table is easy
enough. But how do I get the other properties, ie Apply Border, Apply
Shading, Apply Font etc from the oldTable? (These are the parameters
to the AutoFormat method).
Eg something like oldTable.Format.ApplyBorder
NB: I cannot copy and paste the table, and then write cell by cell as
this has performance implications. Therefore, I create the table
contents in text, convert the text to a table and then I want to
simply get the table format from the old table to apply it to the new
table.
to set the format of this table based on another table.
I have code similar to the following:
object oformat = (object)oldTable.AutoFormatType;
newTable.AutoFormat(ref oformat, ref oMissing, ref oMissing, ref
oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref
oMissing, ref oMissing);
As you can see, getting the format type of the old table is easy
enough. But how do I get the other properties, ie Apply Border, Apply
Shading, Apply Font etc from the oldTable? (These are the parameters
to the AutoFormat method).
Eg something like oldTable.Format.ApplyBorder
NB: I cannot copy and paste the table, and then write cell by cell as
this has performance implications. Therefore, I create the table
contents in text, convert the text to a table and then I want to
simply get the table format from the old table to apply it to the new
table.