Report format get lost while creating pdf

Hi all

Within ERPNext V11 and lower, it was possible to format the cell content of a script/query report by js. When the formated report was exporting to pdf, the cell content in the pdf was formatted as same as in the browser view of the report.

But now in V12, the formats will be lost when creating pdf! how can i fix this?

Browser View:

PDF View:

My formatter function:

"formatter":function (value, row, column, data, default_formatter) {
	value = default_formatter(value, row, column, data)
	if (data["Name"] == "ALERT") {
			value = $(`<span>${value}</span>`);
			var $value = $(value).css("background-color", "yellow", "important");
			value = $value.wrap("<p></p>").parent().html();
			
	} else if ((data["Task"] == "End-R")||(data["Task"] == "Sub-R")) {
			value = $(`<span>${value}</span>`);
			var $value = $(value).css("background-color", "red", "important");
			value = $value.wrap("<p></p>").parent().html();
			
	} else if (data["Task"] == "Control") {
			value = $(`<span>${value}</span>`);
			var $value = $(value).css("background-color", "gray", "important");
			value = $value.wrap("<p></p>").parent().html();
			
	} else if (data["Remark"] == "KONFLIKT - Dieser MA arbeitet an diesem Tag nicht!") {
			value = $(`<span>${value}</span>`);
			var $value = $(value).css("background-color", "orange", "important");
			value = $value.wrap("<p></p>").parent().html();
			
	}
	return value;
}
1 Like

Solved by myself with creating a “report”.html file

Thanks for sharing!

1 Like

@joelios

May you share the contents of the “report.html” ?

We should share more of what we did in ERPNext. Reports, custom scripts, apps.