Two problems with latest version3.1.2

In the order batch the aspose cannot preserve the Alignment and the record in yellow is a wrong value the value we send is ‘aya saffiedin’ => ‘aya nsaffiedi’ (always the second record)
In the TepmlateAr if u see the name samar mohammad sheet how it is written wrong on the left column vertical column in black this bug always happen in different format please reply soon today i buy the license please help me solving these issues i attached my files with this mail

Hi,

Thank you for considering Aspose.

The corrupted value issue is shown well, however, could you please provide some more details to allow us help you more efficiently:

  1. What’s wrong with the alignment in GeneratedOrderBatchAr.doc?
  2. What’s wrong with the name in GeneratedTemplateAr.doc?

in GeeneratedOrderBatchAr the title for example was on the right in OrderBatchAr it is on the left. also there is many lines are like this i write my document in arabic and its almost from right the generated file is on left.
in GeneratedTemplateAr there is a problem that the aspose cannot find the end of stream and the name samar mohammad sheet as i said in the left column mohammad samar sheet as u see
thanks for ur quick reply

Note:::: When I use the Aspose.word without licence(Evaluation version)
the GeneratedOrderBatchAr.Doc is good there is no bugs except what u write in red ;
w.r.t TemplateAr.doc I use an old version of Asponse.word.dll ver 2.2.8 to generate the file because the 3.1.2 cannot reach the end of the stream
thank u DmitryV

Note:::: When I use the Aspose.word without licence(Evaluation version)
the GeneratedOrderBatchAr.Doc is good there is no bugs except what u write in red and the alignment;
when i use the 2.2.8.0 the alignment is solved but the worng test is not
w.r.t TemplateAr.doc I use an old version of Asponse.word.dll ver 2.2.8 to generate the file because the 3.1.2 cannot reach the end of the stream
please help me
thank u DmitryV

Okay, so here’re the issues I’ve logged for fixing so far:

  1. Alignment is not preserved
  2. The document throws “Unable to read beyond the end of the stream” exception

However, I definitely cannot see two other problems you have reported.

  1. I performed mail merge on OrderBatchAr.doc and no corrupted name issue occured. Here’s the testing code I used:
DataTable table = new DataTable("Suppliers");

table.Columns.Add("PaymentNumber", typeof(string));
table.Columns.Add("ContactFirstName", typeof(string));
table.Columns.Add("ContactFamilyName", typeof(string));
table.Columns.Add("PO", typeof(string));
table.Columns.Add("PT", typeof(string));
table.Columns.Add("UnitCategory", typeof(string));
table.Columns.Add("PaymentAmountB", typeof(string));
table.Columns.Add("OrderCommission", typeof(string));

table.Rows.Add(new object[] {"1", "aya", "saffeidin", "1", "1", "1", "100", "1000"});
table.Rows.Add(new object[] {"2", "aya", "saffeidin", "1", "1", "1", "100", "1000"});
table.Rows.Add(new object[] {"3", "aya", "saffeidin", "1", "1", "1", "100", "1000"});
table.Rows.Add(new object[] {"4", "aya", "saffeidin", "1", "1", "1", "100", "1000"});
table.Rows.Add(new object[] {"5", "aya", "saffeidin", "1", "1", "1", "100", "1000"});

doc.MailMerge.ExecuteWithRegions(table);

Each row including 2nd contains “aya saffeidin” name, see attached. Please make sure you have the proper name in all the records of your data source.

  1. On GeneratedTemplateAr.doc, I can see “samar mohammad sheet” in the left column on every page of the document. No corruptions here as well. I can send you a screenshot if you want. I use MS Word 2003 SP1.

Sorry I’ve mixed up first name and family name; after further investigation I see the corruption, not exactly as you describe but however it is there. So I’m logging this one, too.

So we have one remaining issue that I’m unable to check. I’m attaching a screenshot to assure you that the name in the left column with vertical text direction is not corrupted.

thank u for ur quick reply and interest
i have word without sp1 i will install it and try
thanks alot

Hi,

We have released Aspose.Word 3.1.4.

  • Improved handling of right-to-left tables and paragraphs.

https://docs.aspose.com/words/net/release-notes/

this hotfix doesn’t fix the problem
thank u

Is there any fix for my problem???

I guess the only remaining problem is that occasional field value corruption, isn’t it? We are still looking into it. Thank you for patience.

this is true when the problem will be fixed please help?!

We’re hoping to release a hotfix tomorrow.

Sorry I cannot reproduce the issue, I think it works fine for me. Can we please take it a step back and make sure we are on the same thing.

You only have one RTL issue remaining? The issue is that in the 2nd row of the mail merge table where the value should be “saffeidin” it outputs as “dinsaffei”?

If this is the case, I must admit it very strange that only 2nd row is incorrect since Aspose.Word processes all of the rows in the same way.

Try recreating the first and family name merge fields in the document. I mean delete them and insert anew.

If that does not help, please let me know:

  1. What MS Word version do you use to open the file.
  2. How do you execute the mail merge? Using MailMerge.ExecuteWithRegions?
  3. What is your data source and where does it come from. Make sure you don’t have “dinsaffei” in your data.
  4. In “aya saffeidin” what is the first name and what is the family name?

No it doesn’t help(i also find it in another generated document Feild in table(MailMerge.Execute))

  1. word 2003 with sp1
  2. MailMerge.ExecuteWithRegions
  3. data source is stored procedure result from sql server 2000 database
  4. aya is family name and saffiedin is first name
    thank u

Look, I would really like to fix this issue, but I’m not yet in a position to do so. I’ve got the test from Dmitry that actually reproduces the problem, but it is very strange and intermittent. For example if I delete say one of the paragraphs from the template file and save it, then run mail merge, the problem is sometimes still there, but sometimes it is not. I also seen this text written not only backwards, but literally in random character order something like “finsaddei”.

If you look carefully at the problem area in the template you will see that:

  1. The ContactFirstName field consists of runs of text arranged in RTL order, it is written as >>ContactFirstName<< (note the start and end field markers are swapped).

  2. The ContactFamilyName field consists of runs of text arranged in LTR order, it is written as <>

  3. The paragraph that contains these fields is an RTL paragraph.

The fact that the two fields are somehow different, yet they are supposed to work the same is bothering me.

Since the problem seems to be with the ContactFirstName I modified the document and attached it here. It works for me now, please try it.

Basically I changed the paragraph to be LTR, deleted and inserted ContactFirstName again, changed the paragraph back to RTL.

This is the best fix available for the moment. We will post if we have a better solution later on. Please let us know if you find more RTL problems and attach the documents that have problems here.

i tried your way but it didnt work,
in every table we generate there is only one field that is mixing in one row and one column. In the attached file i am showing a table that is mixing in different ways and there is an explanaton about what happening with us when generating the document.

If you want a solution, we should take it slowly, step by step. Let’s go back to the problem with “aya saffeidin” in the first set of documents.

The right-to-left features are undocumented so I’m working blindfolded, trying to outguess MS Word.

MS Word behaves very strange indeed in this case. It looks like editing other text, chanding cell width, changing text that gets inserted - all might have effect on how MS Word will “randomize” the inserted text. As I said I was able to get “saffeidin”, “dinsaffei”, “insaffeid” etc.

I still stick to the idea that the reason it is happening related to the fact that some portions of your merge fields are RTL and others LTR and that somehow confuses MS Word in a very strange way.

Here is a layout of your original document fields:

FieldStart , is bidi:True
Run , is bidi:True
Run MERGEFIELD ContactFirstName \* MERGEFORMAT, is bidi:False
Run , is bidi:True
FieldSeparator , is bidi:True
Run ?, is bidi:True
Run ContactFirstName, is bidi:False
Run ?, is bidi:True
FieldEnd , is bidi:True

Run , is bidi:True

FieldStart , is bidi:False
Run MERGEFIELD ContactFamilyName \* MERGEFORMAT , is bidi:False
FieldSeparator , is bidi:False
Run ?ContactFamilyName?, is bidi:False
FieldEnd , is bidi:False

As you can see FieldStart, FieldSeparator and FieldEnd in the ContactFamilyName fields are LTR. But FieldStart, FieldSeparator and FieldEnd in the ContactFirstName (the field that causes the problem) are RTL. Also portions inside field code and field results are mixed RTL and LTR runs.

When Aspose.Word inserts data into a mail merge field, it deletes the field from FieldStart to FieldEnd inclusively, but it applies font formatting of the FieldEnd to the newly inserted data. Therefore, the merged result looks like this:

Run aya, is bidi:false
Run , is bidi:True
Run saffeidin, is bidi:true

In general, MS Word allows runs of different directions to be combined inside one paragraph, but in this particular case it looks like it consuses it in a very strange way.

The only solution I see right now is to reinsert the offending merge field.

When you say you tried my way and it did not work I want to receive more details. Was the result exactly the same or different? Maybe you should attach the modified document so I can check it too.

I attached my modified version that works okay, always outputs “aya saffeidin” without mixing it up.