We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Skip the blank merge field on word document

hello there..

in my word.doc have an..

<>

<>

<>

when the merge field address2 were blank it will become like this..

No.5, Third Floor

Florda City

so..how can i skip this blank merge field so the <> will replace it or shift up..

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. I think you should use RemoveEmptyParagraphs. Please see the following link for more information.

http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/aspose.words.reporting.mailmerge.removeemptyparagraphs.html

I hope this could help you.

Best regards.

hello there..

where i must put this statement..Doc.MailMerge.RemoveEmptyParagraphs = True

is it before mailmerge.execute of after...

nway..thanks for the reply..

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. You should put this line before executing mail merge.

Best regards.

hi there..

i already try it..but it doesn't work..

the coding i do is like this...

Public Function Execute(ByVal filterParameter As String, ByVal DocName As String, ByVal param1 As String) As Document

Dim srcDoc As Document = New Document("C:\DotNetProjs\RnD\RnDUI\DOC\" & DocName & ".doc")

Dim dstDoc As Document = srcDoc.Clone()

dstDoc.Sections.Clear()

Dim sqlStmt As String = "select......"

Dim pelesen As DataTable = Me.ExecuteDataTable(sqlStmt)

Dim i As Integer = 0

Do While i < pelesen.Rows.Count

Dim pelesenDoc As Document = srcDoc.Clone()

Dim pelesenRow As DataRow = pelesen.Rows(i)

pelesenDoc.MailMerge.Execute(pelesenRow)

Dim SqlStmt2 As String = "select......"

Dim SLA01 As DataTable = Me.ExecuteDataTable(SqlStmt2)

SLA01.TableName = "SLA01"

pelesenDoc.MailMerge.RemoveEmptyParagraphs = True

pelesenDoc.MailMerge.ExecuteWithRegions(SLA01)

AppendDoc(dstDoc, pelesenDoc)

i += 1

Loop

Return dstDoc

End Function

can you correct it for me if i'm wrong..thanks...

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. RemoveEmptyParagraphs removes only empty paragraphs it does not remove empty rows from table.

I think the information provided in the following link could be useful for you.

Also please attach your document for testing.

Best regards.