Load and save Word template dotx

0 Answers 33 Views
RichTextBox
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Deltaohm asked on 18 Jul 2023, 10:17 AM

Hi.

In attachment I load a file dotx saved as rtf (EmptyTemplate.zip) and the same dotx formatted as rtf by a call to Telerik.Windows.Documents.FormatProviders.Rtf.RtfFormatProvider.Export (12dccb97-adc1-4a10-958a-827d221257a7.zip).
There are some fields that works perfectly until I save the template.
After save the template one field (only one field) stop to works.
The two attachments are quite different, but it is because the first is saved by word and the second is saved by Telerik. The problem can be viewed at keyword SORGENTE_4_Leq: I compared it with the near keyword SORGENTE_4_Min that works on:

 

{\ltrch\f1\fs22\i0\b0\strike0\cf0\ulc0\ulnone\par}\pard\sl259\slmult1\ql\sa160\ltrpar{\field{\*\fldinst{\ltrch\f0\fs22\i0\b0\strike0\cf0\ulc0\ulnone KEYWORDS }{\ltrch\f0\fs22\i0\b0\strike0\cf0\ulc0\ulnone [SORGENTE_4_Leq]}}{\fldrslt{\ltrch\f1\fs22\i0\b0\strike0\cf0\ulc0\ulnone \{[SORGENTE_4_Leq]}}}
{\ltrch\f1\fs22\i0\b0\strike0\cf0\ulc0\ulnone\par}\pard\sl259\slmult1\ql\sa160\ltrpar{\field{\*\fldinst{\ltrch\f0\fs22\i0\b0\strike0\cf0\ulc0\ulnone KEYWORDS \{                                             [SORGENTE_4_Min]}}{\fldrslt{\ltrch\f1\fs22\i0\b0\strike0\cf0\ulc0\ulnone \{[SORGENTE_4_Min]}}}
The two fields are not identically formatted, the first have \{ replaced by {\ltrch\f0\fs22\i0\b0\strike0\cf0\ulc0\ulnone.
In the rtf saved by word we could see that the two fields are identically formatted then the strange effect seems to comes from the Telerik.Windows.Documents.FormatProviders.Rtf.RtfFormatProvider.Export call.

Thank you
Luigi

  

Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
commented on 18 Jul 2023, 10:49 AM

I attached a little wpf app that replies the situation, to use it, put the file "EmptyTemplate.dotx" in the building folder.
Dimitar
Telerik team
commented on 19 Jul 2023, 07:00 AM

Hi Luigi, 

Thank you for the project and the description. I have reproduced the described results but it is unclear to me what is not working. If I open the saved document in Word the field is still visible. What I am missing in this case?

I am looking forward to your reply.  

Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
commented on 19 Jul 2023, 09:24 AM | edited

Thank you Dimitar for your quick reply.
Working with word template is something weird: if you open the rtf you still see the field identical to original, but it is an illusion.
I attached a little video to explain what it is wrong.

As you could see in the video in the code in rtf is missed the first '{'.

Furthermore this behavior is very random. I freezed the situation with the template shared, but I saved it many times before without any problems...

Luigi

 

Dimitar
Telerik team
commented on 19 Jul 2023, 11:17 AM

Hi Luigi,

Thank you for clarifying and for the video.

This is a known issue that is already logged on our feedback portal. You can track its progress, subscribe to status changes, and add your comment to it here: RichTextBox: Exporting field with code ending with curly bracket trims it.

I am afraid that I cannot suggest a workaround.

I want to apologize for the inconvenience this issue is causing you.

Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
commented on 19 Jul 2023, 02:01 PM | edited

Hi Dimitar,
That issue is posted by me and you closed it because I found a workaround, but is not the same problem: there missing the last curly bracket for every tag and every time I save, here is missing the first curly bracket for only one tag and only some times.
Should I open another ticket? But I need a solution to this one because is blocking for me. 
thank you

Luigi

Dimitar
Telerik team
commented on 21 Jul 2023, 12:34 PM

Hi Luigi, 

The issue is not closed and we are going to fix it at some point. The unplanned status indicates that we are currently not working on it. I will see if I can increase its priority.

Nevertheless, I performed some other tests and it appears that this is the same issue. In the original file, the field is separated into two runs and the first one ends with a "{". I have attached an extracted screenshot of the XML that shows this. 

If the file is re-saved with Word, this is corrected and the result is also correct (see the second screenshot).

Let me know if I can assist you further.
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
commented on 21 Jul 2023, 01:09 PM

Thank you Dimitar

I hope that you quick resolve the issue and if it is the same then it will be great.

But I need to activate the feature of saving template in a short time, then I could change the syntax of my tags if I was sure that the problem is due to curly bracket: it would be very unpleasure if I run in a similar situation after I changed all the tags.

Luigi

Dimitar
Telerik team
commented on 24 Jul 2023, 06:23 AM

Hi Luigi, 

Yes, I believe that this is caused by the curly brackets, and changing them in the field syntax will fix this. The curly brackets are an essential part of the RTF format syntax and in our code they are striped for some reason: 

if (this.Context.FieldStack.Count > 0 && this.Context.FieldStack.Peek().IsInInstruciton)
{
    text = text.Trim(new char[] { '{', '}' });
}

Unfortunately, I cannot engage with a timeframe for the resolving of this issue. 

Thank you for your understanding.

 

 

 

 

No answers yet. Maybe you can help?

Tags
RichTextBox
Asked by
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Share this question
or