Not able to get the borders on the TIF

Facing Same issue while unable to get boarder to Tiff…Kindly solve the issue :expressionless:

I am also on the same boat…Looking for some solutions for this issue

@asish312

Thanks for your inquiry. Could you please attach your input Word document here for testing? We will investigate the issue on our side and log separate issue for your case. Thanks for your cooperation.

1 Like

Hi Manzoor.
Thanks for the quick support and response. I am trying to convert outlook message file.So I have attached an .msg file
Please change the code above accordingly
EMAIL.MailMessage msg = EMAIL.MailMessage.Load(sourceFile + “123.msg”, EMAIL.MessageFormat.Msg);

Please keep the .msg file and try to read EmailReadWithBorderissue.png (56.1 KB)
Email.zip (23.7 KB)

https://forum.aspose.com/t/unable-to-get-border-while-converting-email-body-to-tiff-html-pdf/191712?u=asish312

Hi Team,
I love the service and indeed it’s easy and useful dll while converting to multiple type.However I am stuck in converting HTML outlook formatted body to Tiff image. (Dot Net,C# )
Well the objective is to get the border of EmailContent.
with using Aspose I am able to get the page border but as per the requirement, I am trying to convert email body content to Tiff with border.
I trying like this please suggest me any other solutions

//Reading the Email Body using Aspose Email
EMAIL.MailMessage msg = EMAIL.MailMessage.Load(sourceFile + "MLM19021012225556.eml", EMAIL.MessageFormat.Eml);

//Trying to Put Border to Body Content with Style

 string OldString = "<body lang=" + @"""EN-US""" + " link=" + @"""#0563C1""" + " vlink=" + @"""#954F72""" + ">";
                string NewString = "<body lang=" + @"""EN-US""" + " link=" + @"""#0563C1""" + " vlink=" + @"""#954F72""" + " style=" + @"""border: 1px solid black; white-space: nowrap;""" + ">";
                msg.HtmlBody = msg.HtmlBody.Replace(OldString,NewString);

//For Debugging purpose just take the HTML content and paste and border appears in HTML page

   // Convert EMAIL MSG to HTML and save to stream
               MemoryStream msgStream = new MemoryStream();
                msg.Save(msgStream);
 WORDS.DocumentBuilder docBuilder = new WORDS.DocumentBuilder();
        docBuilder.InsertHtml((msg.HtmlBody));  

      WORDS.Tables.Table table = (WORDS.Tables.Table)docBuilder.Do,cument.GetChild(WORDS.NodeType.Table, 0, true);

                //// Auto fit the table to the cell contents
table.AutoFit(WORDS.Tables.AutoFitBehavior.AutoFitToWindow);
docBuilder.Document.Save(targetFile + "SampleTestFile.Tiff");

//Further more I have added Div tag,Paragraph but rendered output from Aspose removed

Note: My Email containing Tables,paragraph,and images

For testing purpose you can create a sample outlook email which contains tables and paragraphs and please try to keep a
sourceFile + “MLM19021012225556.eml”
and process from your end.

Please let me know asap.Little urgent

1 Like

I am trying to convert outlook message file.So I have attached an .msg file
Please change the code above accordingly

EMAIL.MailMessage msg = EMAIL.MailMessage.Load(sourceFile + “123.msg”, EMAIL.MessageFormat.Msg);

Email.zip (23.7 KB)
EmailReadWithBorderissue.png (56.1 KB)

same issue facing

1 Like

@asish312

Thanks for sharing the detail. We have tested the scenario using the latest version of Aspose.Words for .NET 19.2 with following code example and have not found the shared issue.

Aspose.Email.MailMessage.Load(MyDir + "123.msg").Save(MyDir + "input.mhtml");

Document document = new Document(MyDir + "input.mhtml");
document.Save(MyDir + "out.tiff");

If you still face problem, please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

1 Like

Thanks for the response Manzoor.I could not get any border around the email body content.Would you mind helping me out?
Objective: I would like to add border for
1.A table
+
2.Body content of EmailBody
in Tiff file.

Please run the console application and let me know
https://drive.google.com/open?id=1n95pyn5dOXx-Rlegzlyj-UGCVg9EbP1Y

I have attached a sample zip file please download and let me know further

@asish312

Thanks for your inquiry. Unfortunately, we have not found any attachment of console application with your post. Please ZIP and attach it again. Please also share your expected output document. We will investigate the issue and provide you more information on it along with code example.

Thanks for your cooperation.

1 Like

I am sorry previously I assumed zip file attached.But it’s not uploaded.here you go uploading again.
Expected_Output.tiff: Is the output aspose should render
Output.tiff: Is the rendered tiff by Aspose as of now
123: Is the mail content
Please build the application and run it.Let me know your inputs further

https://drive.google.com/open?id=1n95pyn5dOXx-Rlegzlyj-UGCVg9EbP1Y

Note:I am unable to upload .zip file. Even thought it’s showing 100% but not actually uploading.So above is the googledrive link.Kindly download from it

@asish312

Thanks for sharing the detail. Please use the following code example to get the desired output. Hope this helps you.

Aspose.Email.MailMessage.Load(sourceFile + "123.msg").Save(sourceFile + "input.mhtml");

Document document = new Document(sourceFile + "input.mhtml");
document.FirstSection.PageSetup.LeftMargin = 10;
document.FirstSection.PageSetup.RightMargin = 10;
document.FirstSection.PageSetup.TopMargin = 10;
document.FirstSection.PageSetup.BottomMargin = 10;
document.FirstSection.PageSetup.Borders.LineStyle = LineStyle.Single;
document.FirstSection.PageSetup.Borders.LineWidth = 10;
document.Save(sourceFile + "19.2.tiff");
1 Like

I appreciates for the response.However I am interested to make border to only body content not the whole page content. I am trying here to make border to
1.A table with border
+
2.Body content of EmailBody with border
All together in single Tiff file should be the output

I have mentioned previously
Expected_Output.zip (75.8 KB)
.tiff: Is the output aspose should render.

@asish312

Thanks for sharing the detail. Please note that Aspose.Words mimics the behavior of MS Word. The content of email body may render on multiple pages. Please open your MHTML in MS Word, set the borders according to your requirement and share that document here for our reference. We will then provide you code example accordingly.

1 Like

My Bad I can’t see the border in MHTML when tried opening in MS Word.
Do you have any idea why EmailContent border style content does not render when I am trying to save to MHTML?
or any suggestion to get the border to Email Body Content. (Not Page border)

Note: The input script manually when I tried to save as Html I can see the border around it.However When trying to convert MHTML/PDF/HTML through aspose border disappears. Please try to run the console application which previously I had attached.
msg.HtmlBody-----> Input Script containing border
But after
Aspose.Email.MailMessage.Load(sourceFile + “123.msg”).Save(sourceFile + “input.mhtml”);
No more borders :roll_eyes:

appreciate your help :slight_smile:

@asish312,

I request you to please observe this image representing the source MSG and generated MHTML files. Both doesn’t have any borders. Aspose.Email has rendered the output MHTML similar to that of source MSG. If there were any borders in source MSG but missing in exported MHTML, we could have considered this to be an issue in API. I hope the shared elaboration will be helpful.

1 Like

Yes I agree @mudassir.fayyaz
There is no border in the email.But here point is that,as per my requirement I need emailbody border in the output through code change.
That’s why before converting into MHTML/TIF/PDF I am adding this line,(I think we missed this point,Please check the code once again which i shared earlier)

//Trying to Put Border to Body Content with Style

string OldString = “&lt;body lang=” + @""“EN-US”"" + " link=" + @"""#0563C1""" + " vlink=" + @"""#954F72""" + “&gt;”;
string NewString = “&lt;body lang=” + @""“EN-US”"" + " link=" + @"""#0563C1""" + " vlink=" + @"""#954F72""" + " style=" + @""“border: 1px solid black; white-space: nowrap;”"" + “&gt;”;
msg.HtmlBody = msg.HtmlBody.Replace(OldString,NewString);

//or
  //Trying to add Border to Div Section in the Email
                msg.HtmlBody = msg.HtmlBody.Replace("<div class=" + @"""WordSection1""", "<div class=" + @"""WordSection1""" + "style=" + @"""border: 5px solid black; white-space: nowrap;""");

If you see this image.png (15.3 KB)

@asish312

Thanks for sharing the detail. Please note that Aspose.Words mimics the behavior of MS Word. If you open the HTML (msg.HtmlBody) in MS Word, you will get the same output. MS Word sets the border of page.

1 Like

Okay.I can see a page border to whole page while opening via word.(Override the border of table and email body)Well do you have any idea how can I put border to my mail body @tahir.manzoor

I am trying like this

//Trying to Put Border to Body Content with Style

string OldString = “&lt;body lang=” + @""“EN-US”"" + " link=" + @"""#0563C1""" + " vlink=" + @"""#954F72""" + “&gt;”;
string NewString = “&lt;body lang=” + @""“EN-US”"" + " link=" + @"""#0563C1""" + " vlink=" + @"""#954F72""" + " style=" + @""“border: 1px solid black; white-space: nowrap;”"" + “&gt;”;
msg.HtmlBody = msg.HtmlBody.Replace(OldString,NewString);

//or
//Trying to add Border to Div Section in the Email
msg.HtmlBody = msg.HtmlBody.Replace("&lt;div class=" + @""“WordSection1"”", “&lt;div class=” + @""“WordSection1"”" + “style=” + @""“border: 5px solid black; white-space: nowrap;”"");

Do you have any suggestions?? to get border from email body content?
My expectation would be following thisExpected_Output.zip (75.8 KB)