Pokaż i ukryj dodatkowe nagłówki wydruku przy użyciu MHTFormatOptions

Aspose.Email - Pokaż i ukryj dodatkowe nagłówki wydruku przy użyciu MHTFormatOptions

Dodatkowe nagłówki wydruku mogą być wyświetlane lub ukrywane przy użyciu MhtFormatOptions i MailMessageSaveOptions. MhtFormatOptions jest wyliczeniem, które zawiera dwa elementy – WriteCompleteEmailAddressToMht i HideExtraPrintHeader. MhtFormatOptions jest używany wraz z MhtMessageFormatter jako metoda publiczna MhtMessageFormatter.Format z argumentem writeCompleteEmailAddress jest teraz przestarzała.

Java

 String dataPath = \"src/asposefeatures/programmingemail/showhideextraprintheaders/data/\";

String pageHeader = \"<div><div class='pageHeader'>&quot;Panditharatne, Mithra&quot; &lt;mithra.panditharatne@cibc.com&gt;<hr/></div>\";

MailMessage message = MailMessage.load(dataPath + \"message.eml\");

MhtMessageFormatter mailFormatter = new MhtMessageFormatter();

int options = MhtFormatOptions.HideExtraPrintHeader | MhtFormatOptions.WriteCompleteEmailAddressToMht;

mailFormatter.format(message, options);

if(!message.getHtmlBody().contains(pageHeader))

	System.out.println("True");

else

	System.out.println("False");

Pobierz działający kod

Pobierz Show and Hide Extra Print Headers using MHTFormatOptions z dowolnej z poniżej wymienionych platform kodowania społecznego: