View Single Post
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
AMR AMR is offline
external usenet poster
 
Posts: 6
Default MailMergeDataSource iteration extremly slow

Hi

I'am reading addresses from a MailMergeDataSource in Word 2007.
My problem is, that this is extremly slow. Every invoke from get_Item will
take a sec.
The app is a C# Word 2007 Application Add-In.

Is there some solution to speed it up or an another approach to solve the
issue?

Code:

object indexLastname = MailMergeDataFieldIndices.Lastname;
object indexFirstname = MailMergeDataFieldIndices.Firstname;
object indexCompany = MailMergeDataFieldIndices.Company;
object indexStreet = MailMergeDataFieldIndices.Street;
object indexZip = MailMergeDataFieldIndices.Zip;
object indexCity = MailMergeDataFieldIndices.City;

object index = MailMergeDataFieldIndices.None;
for (int i = 0; i count; i++) {
string name = fields.get_Item(ref indexFirstname).Value + " " +
fields.get_Item(ref indexLastname).Value;
string company =fields.get_Item(ref indexCompany).Value;
string street =fields.get_Item(ref indexStreet).Value;
string zip = fields.get_Item(ref indexZip).Value;
string city = fields.get_Item(ref indexCity).Value;

dataSrc.ActiveRecord =
Word.WdMailMergeActiveRecord.wdNextDataSourceRecor d;
}

Thanks in advance
amr