mirror of https://github.com/M66B/FairEmail.git
Remove Microsoft Office sections on printing
This commit is contained in:
parent
13c9fec6ef
commit
cf84f733d9
|
@ -7363,10 +7363,15 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
Document document = JsoupEx.parse(file);
|
Document document = JsoupEx.parse(file);
|
||||||
HtmlHelper.embedInlineImages(context, id, document, true);
|
HtmlHelper.embedInlineImages(context, id, document, true);
|
||||||
|
|
||||||
// Prevent multiple pages for Microsoft Office
|
// @page WordSection1 {size:612.0pt 792.0pt; margin:70.85pt 70.85pt 70.85pt 70.85pt;}
|
||||||
Element section = document.select(".WordSection1").first();
|
// div.WordSection1 {page:WordSection1;}
|
||||||
if (section == null)
|
// <body><div class=WordSection1>
|
||||||
section = document.body();
|
|
||||||
|
for (Element element : document.body().select("div[class]")) {
|
||||||
|
String clazz = element.attr("class");
|
||||||
|
if (clazz.startsWith("WordSection"))
|
||||||
|
element.removeClass(clazz);
|
||||||
|
}
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
boolean print_html_header = prefs.getBoolean("print_html_header", true);
|
boolean print_html_header = prefs.getBoolean("print_html_header", true);
|
||||||
|
@ -7431,7 +7436,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
|
|
||||||
header.appendElement("hr").appendElement("br");
|
header.appendElement("hr").appendElement("br");
|
||||||
|
|
||||||
section.prependChild(header);
|
document.body().prependChild(header);
|
||||||
|
|
||||||
boolean hasAttachments = false;
|
boolean hasAttachments = false;
|
||||||
Element footer = document.createElement("p");
|
Element footer = document.createElement("p");
|
||||||
|
@ -7450,10 +7455,10 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasAttachments)
|
if (hasAttachments)
|
||||||
section.appendChild(footer);
|
document.body().appendChild(footer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new String[]{message.subject, section.html()};
|
return new String[]{message.subject, document.body().html()};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue