J
Jan - LundK
Hello,
I'd like to do a mail merge using word. Some of my fields have a length of
1000 characters but get truncated after 315 characters.
I'm using a html file as data source (Data is stored in a Table)
The mail merge is executed by a C# COM-AddIn and uses the Office 2003 PIAs.
Everything works fine except for the truncated fields.
Anyone has a tip for me?
Here's a part of the source code:
...
Microsoft.Office.Interop.Word.MailMerge mm = wordDoc.MailMerge; // wordDoc
is a function parameter, the type is Microsoft.Office.Interop.Word.Document
object omissing = System.Reflection.Missing.Value;
String Source = "c:\test.html";
object Format =
Microsoft.Office.Interop.Word.WdOpenFormat.wdOpenFormatWebPages;
object ConfirmConversions = false;
object ReadOnly = false;
object LinkToSource = false;
object AddToRecentFiles = false;
object PasswordDocument = "";
object PasswordTemplate = "";
object Revert = false;
object WritePasswordDocument = "";
object WritePasswordTemplate = "";
object Connection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
DataFileName + ";Mode=Read;Extended Properties=\"HTML Import;HDR=YES;\"";
object SQLStatement = "SELECT * FROM `table` ";
object SQLStatement1 = "";
object OpenExclusive = false;
object SubType =
Microsoft.Office.Interop.Word.WdMergeSubType.wdMergeSubTypeOLEDBText;
object objFalse = false;
// DocumentType is passed as parameter
mm.MainDocumentType = docType;
#region OpenDataSource
mm.OpenDataSource(
Source,
ref Format,
ref ConfirmConversions,
ref ReadOnly,
ref LinkToSource,
ref AddToRecentFiles,
ref PasswordDocument,
ref PasswordTemplate,
ref Revert,
ref WritePasswordDocument,
ref WritePasswordTemplate,
ref Connection,
ref SQLStatement,
ref SQLStatement1,
ref OpenExclusive,
ref SubType);
#endregion
mm.SuppressBlankLines = true;
// Fields are replaced by data
mm.ViewMailMergeFieldCodes = 0;
wordApp.ScreenUpdating = false;
mm.Execute(ref omissing);
...
Thanks
jan
I'd like to do a mail merge using word. Some of my fields have a length of
1000 characters but get truncated after 315 characters.
I'm using a html file as data source (Data is stored in a Table)
The mail merge is executed by a C# COM-AddIn and uses the Office 2003 PIAs.
Everything works fine except for the truncated fields.
Anyone has a tip for me?
Here's a part of the source code:
...
Microsoft.Office.Interop.Word.MailMerge mm = wordDoc.MailMerge; // wordDoc
is a function parameter, the type is Microsoft.Office.Interop.Word.Document
object omissing = System.Reflection.Missing.Value;
String Source = "c:\test.html";
object Format =
Microsoft.Office.Interop.Word.WdOpenFormat.wdOpenFormatWebPages;
object ConfirmConversions = false;
object ReadOnly = false;
object LinkToSource = false;
object AddToRecentFiles = false;
object PasswordDocument = "";
object PasswordTemplate = "";
object Revert = false;
object WritePasswordDocument = "";
object WritePasswordTemplate = "";
object Connection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
DataFileName + ";Mode=Read;Extended Properties=\"HTML Import;HDR=YES;\"";
object SQLStatement = "SELECT * FROM `table` ";
object SQLStatement1 = "";
object OpenExclusive = false;
object SubType =
Microsoft.Office.Interop.Word.WdMergeSubType.wdMergeSubTypeOLEDBText;
object objFalse = false;
// DocumentType is passed as parameter
mm.MainDocumentType = docType;
#region OpenDataSource
mm.OpenDataSource(
Source,
ref Format,
ref ConfirmConversions,
ref ReadOnly,
ref LinkToSource,
ref AddToRecentFiles,
ref PasswordDocument,
ref PasswordTemplate,
ref Revert,
ref WritePasswordDocument,
ref WritePasswordTemplate,
ref Connection,
ref SQLStatement,
ref SQLStatement1,
ref OpenExclusive,
ref SubType);
#endregion
mm.SuppressBlankLines = true;
// Fields are replaced by data
mm.ViewMailMergeFieldCodes = 0;
wordApp.ScreenUpdating = false;
mm.Execute(ref omissing);
...
Thanks
jan