Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Saving and printing dynamic fonts and formats.

Former Member
0 Kudos

Hi all.

In our SAP system the user can type in and save texts. The text editor we are using supports variable fonts and formats, but when it comes to printing, this format does not appear correctly in the smartform solution we have implemented. See the example in the attachment. 

For example the text appears with the signs <H><U> in the printing, if the text should be bold with underline. In the editor the text appears correctly (without these signs, and with bold and underline).

As far as I have studied this, I have not found any way to display a text in a smartform printing with same format - as it is typed into the text editor. The print preview program showed in the example file is not a smartform solution; it is the old SAP script technic which is included in the text editor.

Do you know of any way to edit and save text in SAP (using some text editor) with dynamic character format, and print it with the same format on paper (using smarform/adobe...etc)?

We would prefer not to go back to SAP scripts technic if possible. If there are other editors and print technic that supports his functionality I just described, we would rather use them. Any suggestions?

Regards,

Stefan

1 ACCEPTED SOLUTION

Former Member
0 Kudos

In the SmartForm styles, one needs the same character formats that are utilized in the text.   Create the needed character and paragraph formats in a SmartStyle, and then assign that SmartStyle to your SmartForm.  One can then include texts that have the embedded character format commands.  Alternatively, if the entire row needs that formatting, create a paragraph format, and include that format as the format in the TDFORMAT field of your included text.

Message was edited by: David Lindsey

7 REPLIES 7

Former Member
0 Kudos

In the SmartForm styles, one needs the same character formats that are utilized in the text.   Create the needed character and paragraph formats in a SmartStyle, and then assign that SmartStyle to your SmartForm.  One can then include texts that have the embedded character format commands.  Alternatively, if the entire row needs that formatting, create a paragraph format, and include that format as the format in the TDFORMAT field of your included text.

Message was edited by: David Lindsey

0 Kudos

Hi David.

As far as I know Smart Styles, it is not possible to select character fonts and formats dynamically. Only statically when designing the smartform by selecting the text you want to change and pick the correct format.

If you know how to do it dynamically, can you give more specific example?

Stefan

0 Kudos

What I have done is to store my character formats, tabs, etc., into the text.  In my case, I start out with some lines.  I format into a table of type tline using RKD_WORD_WRAP to store as 132 character tdline values, then call SAVE_TEXT to store as a text object.  After my Smartform is output, I delete the text.  I pass the text to the Smartform as part of the input data file row, with a section for TDID, TDOBJECT, TDNAME.  In my Smartform, I have a "Include text" node where I pass these values, like "&<LFS_R>-TDNAME&, etc.

In my SmartStyles, I have paragraph formats for lines of output (such as headers, etc).  I put these into the TDFORMAT field of the lines of text I create. For instance, Paragraph format CT might be for text that is title text and centered on the page.  My text row would have CT Some texts. The paragraph format then has the needed font, bold, indicator, etc. that applies to the entire row.

Then for just text lines, I embed my character formats like < b > my text < / > directly into the lines of the text, along with my double-comma tabs, etc. (drop the spaces), specifying HT, perhaps, Helvetica 10 (same as Arial).  This might look like HT < b > some data < / > ,, < bi > more data < / >,,, etc., where b might be bold and bi might be bold and italic.

The Smart Style is assigned in the output options of each node.  You could have more than one SmartStyle per form, and in some cases I do have that, since the same SmartStyle could be utilized in other forms..  Using this, you could specifiy particular fonts, bold, underline, italic, any combination thereof, etc., as long as you keep creating the character formats that do what you need, and embedding those in the text line at the proper point.

You only need to 1: define the character formats in the SmartStyle, then 2: embed the start and stop of the specific character format into you lines of text and 3: assign the SmartStyle to your output include text node.

I choose to utilize this method to allow SmartForms to manage line breaks, etc., to optimize the output for the form, rather than having a list of lines to be printed.

Message was edited by: David Lindsey

0 Kudos

Hi David.

Thank you for nice example. This is what I am trying to achieve. The key is to use Dynamic and/or Include Text types. I have already started to try this out in local program and every thing is looking good. Even without using Smart styles I can create a text in editor with (for example) underline and bold and send it to smartform, using the "include Text" type or "Dynamic Text" type in text area, and everything is printing with desired format. The trick is to use import parameter of the type TSFTEXT, when using Dynamic Text. The next step for me is to use smart styles with more character formatting options as you described.

Thanks,

Stefan

Former Member
0 Kudos

Hi Stefan

I've not attempted this idea so I can't guarantee it will work smoothly but...

You could try creating the Smartform with a section that can hold your HTML text but don't fill it with anything. Then, rather than outputting the Smartform directly to a printer, try converting it to HTML. Once in HTML form, parse the Smartform's HTML to find the section you set aside and embed/insert the HTML text into the larger HTML document (I hope you know HTML as you may need to strip off some tags or add others as required). Now that you have a complete HTML document you can send it to the printer instead of the Smartform.

This was all off the top of my head so might not work exactly as described here but it might give you something to aim for.

Regards
Glen

0 Kudos

Hi Glen

Thank you for interesting idea. I am not sure how to do or if it is possible to do HTML section in smartforms, but I will check this out. Perhaps this method could also be an option using Adobe forms, using XML or HTML. If I have time, I will study this more

Regards,

Stefan

0 Kudos

Hi Stefan

Sorry that statement might have been a bit misleading...

What I meant was you could add an element to the Smartform that you could easily find later when parsing the Smartform's HTML (could be something as simple as a text element with a unique text value - eg. "**Inject HTML text here**"). The Smartform itself would know nothing about the HTML text you will later inject into it. The only concern I would have is that it might be difficult to get the layout correct in every situation... but that might just be pessimism.

But if David's method works for you, that's great.

Good luck with it all
Glen