Question

Is there a way to export to pdf / print the timeline tab of a section ?

Hi community,

 

I was wondering if there was a way to add a "PRINT" button to a section which when clicked will export a whole tab (in this case the timeline tab) to PDF or directly print the whole timeline tab ?

 

I am pretty sure that it needs some coding to be done but in which way ?

Is it necessary to call some APIs via C# code ?

 

Many thanks for the help provided.

 

Best regards,

Jonathan

Like 1

Like

5 comments

Hi Jonathan,

 

The timeline tab displays information from connected entities (like activities or orders and so on). That's why this task can be completed without additional development by the correct specifying of the table part in the printable and exporting data needed.

Hi Oleg,

 

Thank you for the answer. I have searched a bit in the system but did not found how to achieve this.

 

Can you explain me a bit further "by the correct specifying of the table part in the printable and exporting data needed."

 

Many thanks,

Jonathan

Jonathan Quendoz,

 

there is no separate documentation on this matter since this functionality is similar to the details functionality on the page. You can setup table part in printalbes here:

Once you select adding a new record there you will see the page where you can select the object you are interested in and the connection setup between your master object (from which the print will be performed) and the target object (where connected data is located). In this example below:

my master entity is the "Contacts" section (since I create a Word report based on it) and the target entity is the "Activity" section. Once saved you can get the information on the "Subject", "Start" and "Due" columns of all activities connected to the contact from which the printable was generated and only activities where this contact is specified as "Owner" will be displayed. Additional filtration of activity records can be added to the "Table filters" tab (in the screenshot above).

 

In the report designer you can add this table part as in this example below:

As a result once you print data you will get this file:

Just perform a couple of tests using report tables and using them you will be able to get the same data that is located in the timeline.

Oleg Drobina,

 

When exporting the "Email" Activity type, how can I export the whole email text ? I have tried with the "body" column but it print the whole html body and not only the text.

 

In addition, how can I export all the activites from the timeline ? I have tried to implement it your way but id has printed only the last activity of the concerned contact.

 

Many thanks for the clarifications.

 

Best regards,

Jonathan

Jonathan Quendoz,

 

It should export all activities related to the contact, maybe the filtration or the connection was specified in the way that made the system to get only one activity instead of several activities. Maybe its because the contact you are interested in is not an owner or reported of missing activities, but is present as the activity participant in those activities.

 

As for the email - the body column in the object contains the HTML code as well (that is then displayed in the "Rich_text" column type so that's why you don't see HTML tags). In this case a custom macro should be created to process the subject column and remove HTML tags from it. For example you can create a custom macro as described here for the "Subject" column and inside this macro process the received HTML code using the code below (received from base method that is used in the incident registration from incoming emails where email body goes to the case description):

protected virtual string ClearHtmlText(string inputString) {
			var htmlWithoutImages = Regex.Replace(inputString, @"(<img\/?[^>]+>)", string.Empty, RegexOptions.IgnoreCase);
			var noCss = Regex.Replace(htmlWithoutImages, @"/\*.+?\*/", string.Empty, RegexOptions.Singleline);
			var noFormatting = Regex.Replace(noCss, @"/<!--[\s\S]*?-->/g", string.Empty, RegexOptions.IgnoreCase);
			var noStyle = Regex.Replace(noFormatting, "<style.*?</style>", string.Empty, RegexOptions.Singleline);
			var noScript = Regex.Replace(noStyle, "<script.*?</script>", string.Empty, RegexOptions.Singleline);
			var noHTML = noScript.Replace("\r\n</span>", " </span>");
			noHTML = noHTML.Replace("</span>\r\n", " </span>");
			noHTML = Regex.Replace(noHTML, @"<div>|<li>", "\r\n");
			noHTML = Regex.Replace(noHTML, @"\r\n{2,}", "\r\n");
			noHTML = Regex.Replace(noHTML, @"<[^>]+>|", string.Empty);
			noHTML = Regex.Replace(noHTML, "<.*?>", string.Empty);
			noHTML = HttpUtility.HtmlDecode(noHTML);
			noHTML = Regex.Replace(noHTML, @"^\s+$[\r\n]*", "\r\n", RegexOptions.Multiline);
			noHTML = Regex.Replace(noHTML, @"<base[^>]*>", string.Empty, RegexOptions.IgnoreCase);
			if (noHTML.StartsWith("\r\n")) {
				noHTML = noHTML.Substring(2, noHTML.Length - 2);
			}
			return noHTML;
		}

 

Show all comments