So what you are doing is inserting a table into a document and then
formatting and populating each cell of the table with some text.
I wonder whether it might not be quicker to pass a string with the elements
in each row separated with a vbTab and each row terminated with a vbCr and
then convert the text to a table.
I also wonder whether the routine of turning everything off is taking longer
that just leaving it the way it is.
--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
Igor said:
Hi!
Here is my code where i create table.
I work from VS .NET with C#
public bool CreateTable(Word.Document oDocument)
{
Word.Range oIRange;
Word.Table oITable;
object oDefaultTableBehavior = 0;
object oAutoFitBehavior = Word.WdAutoFitBehavior.wdAutoFitContent;
object oDirection = Word.WdCollapseDirection.wdCollapseEnd;
object oBreak = Word.WdBreakType.wdLineBreak;
bool bPagination;
bool bCheckSpellingAsYouType;
bool bCheckGrammarAsYouType;
bool bSuggestSpellingCorrections;
bool bSuggestFromMainDictionaryOnly;
bool bCheckGrammarWithSpelling;
bool bShowReadabilityStatistics;
bool bIgnoreUppercase;
bool bIgnoreMixedDigits;
bool bIgnoreInternetAndFileAddresses;
bool bStrictInitialAlefHamza;
bool bStrictFinalYaa;
if ( oDocument == null ) return false;
oIRange = Find("Some value");
if ( oIRange == null ) return false;
oITable = oDocument.Tables.Add(oIRange, iRows, iCols, ref
oDefaultTableBehavior, ref oAutoFitBehavior);
// Prevent Screen Updating
oDocument.Application.ScreenUpdating = false;
bPagination = oDocument.Application.Options.Pagination;
oDocument.Application.Options.Pagination = false;
// Stop Spell And Grammar Checking
bCheckSpellingAsYouType =
oDocument.Application.Options.CheckSpellingAsYouType;
oDocument.Application.Options.CheckSpellingAsYouType = false;
oDocument.Application.Options.CheckGrammarAsYouType;
oDocument.Application.Options.CheckGrammarAsYouType = false;
bSuggestSpellingCorrections =
oDocument.Application.Options.SuggestSpellingCorrections;
oDocument.Application.Options.SuggestSpellingCorrections = false;
bSuggestFromMainDictionaryOnly =
oDocument.Application.Options.SuggestFromMainDictionaryOnly;
oDocument.Application.Options.SuggestFromMainDictionaryOnly = false;
bCheckGrammarWithSpelling =
oDocument.Application.Options.CheckGrammarWithSpelling;
oDocument.Application.Options.CheckGrammarWithSpelling = false;
bShowReadabilityStatistics =
oDocument.Application.Options.ShowReadabilityStatistics;
oDocument.Application.Options.ShowReadabilityStatistics = false;
bIgnoreUppercase = oDocument.Application.Options.IgnoreUppercase;
oDocument.Application.Options.IgnoreUppercase = true;
bIgnoreMixedDigits = oDocument.Application.Options.IgnoreMixedDigits;
oDocument.Application.Options.IgnoreMixedDigits = true;
bIgnoreInternetAndFileAddresses =
oDocument.Application.Options.IgnoreInternetAndFileAddresses;
oDocument.Application.Options.IgnoreInternetAndFileAddresses = true;
bStrictInitialAlefHamza =
oDocument.Application.Options.StrictInitialAlefHamza;
oDocument.Application.Options.StrictInitialAlefHamza = false;
bStrictFinalYaa = oDocument.Application.Options.StrictFinalYaa;
oDocument.Application.Options.StrictFinalYaa = false;