- Code: Select all
public void AttachAttachment(FileDownloadResult file)
{
try
{
DocPicture picture = new DocPicture(_doc);
Image icon = LoadAttachmentImage(file.Type, file.FileName);
var imageFileName = DrawFileName(icon, file.FileName);
icon.Dispose();
picture.LoadImage(imageFileName);
_par.AppendOleObject(file.TempFilePath, picture, ToOleObjectType(file.Type));
File.Delete(imageFileName);
}
catch(Exception ex)
{
_logger.LogError(ex.ToString());
}
}
In above code, I draw the thumbnail on OLE object and attached to the docx as "Attachment -Chinese.png" shown. The Chinese Characters are displayed properly in Word 2013.
However, when I opened the attachment in Word 2013, the thumbnail change to unrecognized string shown as "Attachment - Chinese after open.png".
How can the file name remain unchange when user open the attachment in Word?