Good day,
for an exported document we are
scanning the document for textboxes containing certain placeholders, for
simplicity's sake let's call it @Image@. All text boxes with this
placeholder are supposed to be filled with a background image and the
placeholder text will be removed, so a user's content may be exported.
When
we export as .pdf this works fine, but in .doc we receive empty
textboxes with the removed placeholder. In the .doc file the text box's
fillstyle is set as 'None'.
Private Sub FillTextboxWithUserImage(textBox As WTextBox, paragraph As IWParagraph)
Dim profileImage = GetProfileImage(*some parameters, this part works*).ProfileImage
Dim backup As Image = New Bitmap(profileImage)
paragraph.Text = ""
textBox.TextBoxFormat.FillEfects.Type = BackgroundType.Picture
textBox.TextBoxFormat.FillEfects.Picture = profileImage
ResizeTextboxToImageRatio(textBox, backup)
End Sub
Private Sub ResizeTextboxToImageRatio(textBox As WTextBox, sourceImage As Image)
Dim imageRatio As Double = sourceImage.Width / sourceImage.Height
If textBox.TextBoxFormat.Width < textBox.TextBoxFormat.Height Then
textBox.TextBoxFormat.Height = textBox.TextBoxFormat.Width / Convert.ToSingle(imageRatio)
Else
textBox.TextBoxFormat.Width = textBox.TextBoxFormat.Height * Convert.ToSingle(imageRatio)
End If
End Sub
We
are a bit lost right now, as nothing in the above functions seems off
and it works flawlessly in the .pdf version, which obviously is
generated from the same document. Is there a bug we do not know about?
Our customers are getting very angry at us by now, but we don't know how
to get it running. Do we maybe need to change a setting?