Unexpected measurement units error

Hi,
Our web application (developed in asp.net) uses aspose.word to create word document and MailMerge. The attached word template was working fine with the coding below on aspose.word version 2.4. Recently, we upgraded our Aspose to 3.4 and received error below when try to create document using aspose.word.
Error messge:

  1. Exception Information

Exception Type: Aspose.Word.PleaseReportException
Message: Unexpected measurement units. For free technical support, please post this error and the file in the Aspose.Word Forums http://www.aspose.com/forums/ShowForum.aspx?ForumID=75.
TargetSite: Int32 ᒜ(ޘ.ฐ)
HelpLink: NULL
Source: Aspose.Word
StackTrace Information

at ೰.ᑼ.ᒜ(ฐ ᒝ)
at ೰.ᑼ.ᐲ(ᅏ ᏾, ᐳ ᏿, Int32 ᐀, BinaryReader ق)
at ဩ.ᑣ.ᏽ(ᅏ ᏾, ᐳ ᏿, Int32 ᐀, BinaryReader ق)
at ೰.ᐹ.৮(Byte[] ᅎ)
at ဩ.ᑣ.৮(኶ ኼ, Byte[] ᅎ)
at ဩ.ဨ.ဵ(Int32 ံ, ᅅ ့, ໺& း, ᑳ& ္, Ꮢ& ်)
at ဩ.ᙿ.ᚋ(Int32 ံ)
at ဩ.ᙿ.ᚉ(᚟ ᚊ)
at ဩ.ᙿ.׺(Int32 ᚈ, Int32 Ԟ)
at ဩ.ᙿ.׺()
at ဩ.ဨ.৮()
at Aspose.Word.Document.ك(Stream Ը, String ஹ, LoadFormat ൹, String ߺ)
at Aspose.Word.Document..ctor(Stream stream)
at Dataract.e5.Web.ModalWord.AsposeMerge(Byte[] oTemplate, String sWorkXML)
at Dataract.e5.Web.ModalWord.CreateWord()
at Dataract.e5.Web.ModalWord.btnOK_Click(Object sender, EventArgs e)
For more information, see Help and Support Center at

Codes work in version 2.4

Private Function AsposeMerge(ByVal oTemplate As Byte(), ByVal sWorkXML As String) As Byte()
Dim oWorkXML As XmlDocument
Dim oWorkNodes As XmlNodeList
Dim oWorkNode As XmlElement
Dim oActivityNode As XmlNode
Dim sName, sVal, sId As String
Dim oTemplateStream As New System.IO.MemoryStream(oTemplate)
oTemplateStream.Write(oTemplate, 0, oTemplate.Length)
oTemplateStream.Flush()
oTemplateStream.Position = 0
Dim oLicence As New Aspose.Word.License
oLicence.SetLicense("Aspose.Custom.lic.xml")
Dim oDoc As Aspose.Word.Document = New Aspose.Word.Document(oTemplateStream)
oWorkXML = New XmlDocument
oWorkXML.LoadXml(sWorkXML)
UpdateWordDocWithAction(oWorkXML, oDoc, "Date")
UpdateWordDocWithAction(oWorkXML, oDoc, "User")
UpdateWordDocWithAction(oWorkXML, oDoc, "UserName")
UpdateWordDocWithAction(oWorkXML, oDoc, "UserEmail")
UpdateWordDocWithAction(oWorkXML, oDoc, "SiteUrl")
oWorkNodes = oWorkXML.DocumentElement.SelectSingleNode("//e5Work/Properties").ChildNodes
For Each oWorkNode In oWorkNodes
sId = oWorkNode.GetAttribute("Id")
sName = "e5Work/" + sId
sVal = oWorkNode.GetAttribute("ResolvedValue")
UpdateWordDocPropertiesByControl(oDoc, sName, sVal)
MailMergeWordDocgeByControl(oDoc, sName, sVal)
Next
oActivityNode = oWorkXML.DocumentElement.SelectSingleNode("//e5Work/ActivityProperties")
If Not oActivityNode Is Nothing Then
oWorkNodes = oActivityNode.ChildNodes
For Each oWorkNode In oWorkNodes
sId = oWorkNode.GetAttribute("Id")
sName = "e5Activity/" + sId
sVal = oWorkNode.GetAttribute("ResolvedValue")
UpdateWordDocPropertiesByControl(oDoc, sName, sVal)
MailMergeWordDocgeByControl(oDoc, sName, sVal)
Next
End If
Dim oDocStream As New System.IO.MemoryStream
oDoc.Save(oDocStream, SaveFormat.FormatDocument)
oDocStream.Flush()
oDocStream.Position = 0
Return oDocStream.ToArray()
End Function
Private Sub UpdateWordDocPropertiesByControl(ByVal oDoc As Document, ByVal sPropName As String, ByVal sValue As String)
Dim oProp As DocumentProperty
For Each oProp In oDoc.CustomDocumentProperties
If oProp.Name.ToUpper = sPropName.ToUpper Then
oProp.Value = sValue
Exit For
End If
Next
End Sub
Private Sub MailMergeWordDocgeByControl(ByVal oDoc As Document, ByVal sPropName As String, ByVal sValue As String)
Dim aMergeFields() As String
Dim sFieldName As String
aMergeFields = oDoc.MailMerge.GetFieldNames
For Each sFieldName In aMergeFields
If sFieldName.ToUpper = sPropName.ToUpper Then
oDoc.MailMerge.Execute(New String() {sFieldName}, New Object() {sValue})
Exit For
End If
Next
End Sub

Regards,
Natalie

Hi Natalie,
Please upgrade to the latest version of the component (currently 3.5) since it doesn’t throw when working with your template. After you have upgraded, report us if you have your template working and if the output is as good as when using version 2.4.