Free Support Forum - aspose.com

Moving data from one doc to another

Hello,<?xml:namespace prefix = o ns = "urnTongue Tiedchemas-microsoft-comSurprisefficeSurpriseffice" /><oStick out tongue></oStick out tongue>

<oStick out tongue></oStick out tongue>

I am using Aspose.word and I seem to have a problem moving data from one doc to another.<oStick out tongue></oStick out tongue>

<oStick out tongue></oStick out tongue>

Here is my problem.<oStick out tongue></oStick out tongue>

<oStick out tongue></oStick out tongue>

I have Doc1.doc that contains all kind of mergefileds. I pock my values as follow:<oStick out tongue></oStick out tongue>

<oStick out tongue></oStick out tongue>

Example:<oStick out tongue></oStick out tongue>

For Each fld In doc.MailMerge.GetFieldNamesEx<oStick out tongue></oStick out tongue>

builder.MoveToMergeField(fld)<oStick out tongue></oStick out tongue>

builder.Font.Name = "Arial"<oStick out tongue></oStick out tongue>

Select Case fld<oStick out tongue></oStick out tongue>

Case "Applicant.Name"<oStick out tongue></oStick out tongue>

For Each elm In XmlDoc.DocumentElement.SelectNodes("production")<oStick out tongue></oStick out tongue>

builder.Write(elm1.GetAttribute(FieldName)) <oStick out tongue></oStick out tongue>

Next<oStick out tongue></oStick out tongue>

End select<oStick out tongue></oStick out tongue>

next <oStick out tongue></oStick out tongue>

<oStick out tongue></oStick out tongue>

One of MergeField need to get it’s data from other document (Formatted), so I tried to uses Section class:<oStick out tongue></oStick out tongue>

Here is what I have done.<oStick out tongue></oStick out tongue>

Private _subSection As Aspose.Word.Section<oStick out tongue></oStick out tongue>

docsub = word.Open(MapPath(".") + "SubDoc.doc")<oStick out tongue></oStick out tongue>

If (docsub.Sections.Count > 0) Then<oStick out tongue></oStick out tongue>

_subSection = docsub.Sections(0)<oStick out tongue></oStick out tongue>

End If<oStick out tongue></oStick out tongue>

<oStick out tongue></oStick out tongue>

Now that I Have my section. What can I do load my Doc1 using builder.Write.<oStick out tongue></oStick out tongue>

Would I be able to covert my section to string?<oStick out tongue></oStick out tongue>

Try Section.Range.Text