Date Formatting & Table Column Allignment Problem

I am busy evaluating Aspose.Words for Java, we need it inorder to do a mailmerge using a CSV file as datasource. I have been able to setup a quick prototype (getting a ResultSet from the CSV file), but found two problems with it already:
1.)First problem was that the merged date value wasn’t formatted correctly:
There are two date fields in the source file, one is in the format 2011/10/17 (YYYY/MM/DD) and needs to be merged into a date field with the following formatting set: @ “yyyy/MM/dd”. The result however is 0184/10/17. It seems to get the year wrong. The second date field is in the format 20101015 (YYYYMMDD) and needs to be merged into a date field with the following formatting set: # “0000/00/00”. But the result is 20101015 //.
I should probably note that we can change the formatting in the template, but not in the source file as these are not in our control and there are litterally hundred different one’s being used and there simply isn’t time to have them changed (so best we can do if need be, is to change the format on the template).
2.)Second problem that I have picked up so far is that the allignment of any table columns are changed during the merge. They need to stay exactly the same as they were on the template.
I was previously using the OLEAutomation and found that calling Word’s Mail-Merge did the merge 100% using the date formatting as specified and the table’s allignment were left exactly as was. The problem we are having with opening Word handlers is that they tend to get out of control and actually started opening MS Word and running the Mail-Merge in the foreground which eventually leads to handler conflicts.
I have only two days to evaluate your software before I need to make an informed decision for our business to purchase the licenses. Hope you can help me asap.
Thank you and regards
Izaak

Hi Izaak,
Thank you for your interest in Aspose.Words.

  1. I think, the problem with date formatting occurs because Aspose.Words cannot recognize the string value from your CSV file as a valid Date. You can try to convert the string values to Date upon reading your CSV file into ResultSet.
  2. Could you please attach a sample template that will allow us to reproduce the problem with alignment?

We will check the issue and provide you more information.
Best regards,

Hi Alexey,
herewith the template and the datasource.
I am not so sure if the Date convertion code will work seeing as we need a dynamic solution: Our requirement is for users to design templates wherein they specify the mergefields (say for example LETDATE). They then give the name of the fields to our channels that provide us with a CSV file that uses the correct fieldnames.
We cannot write code everytime a new template is created by a user and a new date field is setup in order to convert that date? How would you suggest this to work dynamically?
Thank you and regards
Izaak

Hi Alexey,
Do you need anymore information or files from me to test this?
Regards
Izaak

Hi Izaak,
Thank you for additional information.

  1. I Managed to reproduce the problem with number formatting. Your request has been linked to the appropriate issue. We will let you know once it is resolved.
    By the way, this issue is specific to Java version of Aspose.Words. This works perfectly in .NET version.
  2. Unfortunately, I cannot see any changes in column alignments after executing mail merge. I used the following code for testing:
// For testing purposes I will use arrays as a datasource.
String[] names = new String[] { "LETDATE", "SURNAME", "PCODE", "LINE4", "LINE3", "LINE2", "LINE1", "LETTYPE", "POLICY_NUMBER", "INCEPTDATE", "PREMIUM", "PAYDAY", "SUMINSURED", "BENNAME", "BENDATE", "HL_ACCNO" };
Object[] values = new Object[] { "2011/10/17", "MR SEHORO SHEBE", "0002", "ZA", "PRETORIA", "PRETORIA", "P O BOX 3179", "CFLBH", "CL36", "20110328", "293.39", "28", "500000", "MRS MAMA MARGARET SHEBE", "19700120", "3000009094703" };
Document doc = new Document("C:\\Temp\\temp.docx");
doc.getMailMerge().execute(names, values);
doc.save("C:\\Temp\\out.docx");

Could you please attach the output document produced on your side and the expected output? I will check the issue one more time and provide you more information.
Best regards,

Hi Alexey,
herewith the expected and the actual output. I have run your test and then get the same output, i.e. the table alignment at least stays the same. But when I run my code, the alignment breaks.
Here is my code for testing:

import java.io.File;
import java.sql.ResultSet;
import org.h2.tools.Csv;
import com.aspose.words.DataTable;
import com.aspose.words.Document;
public class MailMergeHandler
{
    private static final String TEMPLATE = "C:/Temp/Template/Welcome Letter - PRINT.docx";
    private static final String SOURCE = "C:/Temp/Template/COVER4LIFEBASIC_WELCOMELETTER_20111017.csv";
    public static void main(String[] args)
    {
        try
        {
            File docTemplate = new File(TEMPLATE);
            Document doc = new Document(docTemplate.getAbsolutePath());
            DataTable table = new DataTable( * getSourceResultSet * (), "Test");
            doc.getMailMerge().execute(table);
            doc.save("C:/Temp/Template/MailMergeOut.doc");
        }
        catch (Exception ex)
        {
            ex.printStackTrace();
        }
    }
    private static ResultSet getSourceResultSet() throws Exception
    {
        File csvFile = new File(SOURCE);
        ResultSet rs = Csv.*getInstance * ().read(csvFile.getAbsolutePath(), null, null);
        return rs;
    }
}

When you say my request has been linked; would these include a fix on the date format for both the formats: @ “yyyy/MM/dd” and # “0000/00/00” ? And more or less how long does it usually take for an issue to be resolved?
Thank you for all your help with this!

Hi Izaak,
Thank you for additional information.

  1. I managed to reproduce the problem on my side. The problem occurs when you save the document in DOC format. For some reason internal cell margins are lost if save document as DOC. If you save the document as DOCX everything is correct. I logged this issue in our defect database.
  2. Yes, I managed to reproduce both of the issue with formatting switches. We will let you know once they are resolved.

Unfortunately, I cannot provide you an estimate at the moment. Our developers will analyze the issues and we will provide you more information.
Best regards,

Hi Alexey,
Thank you so much for your help so far. Saving the document as DOCX can certainly be done on ourside and we do not need to save as DOC, so we can carry on in that regard. Problem solved for us.
I am still busy doing some stress testing as we process quite a number of records per day (at the moment up to 40,000 records) and therefore need to ensure that Aspose.Words is the correct solution for our business case.
Thank you for working on the formatting switches, this is definitely an important requirement for us. I hope you can let me know about the time frame as soon as possible, as I need to give feedback to our CIO in order to make the final decision. We have a little more than a month to change over from the WordMailHandler (our OLE solution) to another one (probably Aspose.Words) and will have to look at something else if your development might take longer.
Thank you again for your quick response and very helpful feedback.
Regards

Hi Izaak,
We will immediately let you know once we have more information about these issues.
Best regards,

Hi Alexey,
I see that a new release was added on the 30th of October. Is there a chance that the date conversion issue you logged might be in the next release?
Thank you kindly
Izaak

Hi Izaak,
Thanks for your inquiry. Unfortunately, I cannot promise that the fixes will be included into the next release. Currently the issues are in the queue for analysis. Once the responsible developers finish analysis we will be able to provide you more information.
Best regards,

Hi Alexey,
Please tell me you have some idea where our issues are in the queue?
Best regards
Izaak

Hi
Thanks for your request. I consulted with our lead Java developer. He told that they are finishing the next iteration of improving our auto-porting mechanism. After this work is done, they plan to work on the issues like yours.
Best regards,

Hi Alexey,
That is really good to hear!
Can you say at all whether or not there is a possibility of the fixes being done before the end of this year still? (no pressure) :wink:
Kind regards
Izaak

Hi Izaak,
Thanks for your request. I cannot promise anything right now, but I think we will be able to fix these issues before the end of this year.
Best regards,

The issues you have found earlier (filed as WORDSNET-441) have been fixed in this .NET update and in this Java update.

The issues you have found earlier (filed as WORDSNET-5427) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The issues you have found earlier (filed as WORDSNET-5427) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(1)