Apache OpenOffice (AOO) Bugzilla – Issue 36594
date field badly imported
Last modified: 2013-09-12 16:02:43 UTC
Import of Date fields created with MS Word 2000/XP creates several mistakes, depending on which format is used for the date field : - problem with a date field created with "dd/mm/yyyy" format : for instance "01/01/2004" becomes "01/01/200404" - problem with a date field created with "dd/mm/yyyy" format : for instance "01 january 2004" becomes "d january yyyy" Note : Happens with OOo 1.1.1, 1.1.2, 1.1.3 but not in 1.1.0 (Linguistic environnement : French)
Created attachment 18879 [details] samples of date fields badly imported in OOo
I can confirm this in OpenOffice 1.1.3 on Windows 2000 Pro, but not with that attachment. I will attach one which demonstrates this defect in my environment (UK English).
Created attachment 20763 [details] Demonstration of badly imported date fields
Created attachment 20764 [details] The last attachment, loaded from DOC and saved in OO format
MRU->MMAHER: with the second attachment, I can reproduce a date field import error - but not with the first one (in 1.1.4 and 2.0_680m66). With the second attachment a datefield like 22 December 2004 turns int "22 in Writer.
mmaher->flr: Your's methinks
2.0rc1 has the same problem (and m130), under windows or linux, the italian or the english version. It becomes dd/09/yyyy (instead of what, in OOo, should be 31/12/1999) Also, the time field, or at least what I used with M$ Office to have time, is converted in date field, and with 31/12/1999 format. So I've something like: Today dd/09/yyyy at: 30/09/2005 instead of Today 30/09/2005 at: 21:40
Hi, I also encounter the same problem when importing / exporting to MS Office forth and back. This happens with Ooo 2.0.2 in Ubuntu 6.06. I have another hint : the problem is that the date format is imported with escaped /. If I : - double click on a wrongly imported date (shows as : dd/01/yyyy ) - I see a format like : dd/12/yyyy - go to 'additional format' at the end of the list - go to the wrongly imported format (that is dd/12/yyyy in my case) - Format code field shows : dd\/MM\/yyyy - but I don't seem to be able to edit it (well, I can edit, but it is not saved) Hope this can help solve this quite annoying bug, when working with 'still using old proprietary software' business partners :-)
Created attachment 38967 [details] A patch which fix the problem
Hi, I have fixed the problem in OOo 2.0.3. I don't think it's the _best_ solution, but it works pretty well. The problem appears on date which were created on Ms Word without specifying a format. I just forced the format, because the method called doesn't seems to do the job. Because I know my patch is not the best, I have left the previous call to the formatter (i.e. : sParams = GetWordDefaultDateStringAsUS(pFormatter, rLang);). Feel free to contact me about this, and please inform me if you integrate it somehow in the next version of OOo. Thanks,
set type to PATCH and reassign to PL
Created attachment 41884 [details] Another fix for date created with no format under Ms Word. I believe it won't work for languages other than french, sadly.
Hello, I had to fix another date problem. You can create a field date in Ms Word which has no specified format. If you open it in a french OOo, it prints '21/01/200707', which is not really what we waiting for. Ms Word displays '21/01/2007', for instance. I have attached the second fix to this issue. I don't believe it's a valid patch for all languages of OOo. This fix is dirty, even if it takes one lines. I just hope it can help you to fix it. I hope more than I can free time to do it myself :). I can provide a sample .doc file for this issue too, if needed. Regards,
I've investigated the problem and the contributed patch - the both contributed patches are the same. As stated in the defect description, we have two problems with the bugdoc <dateFields.doc> in French version of OOo: (1) wrong date format for the year - 01/01/200404 (2) no year and no day - d janvier yyyy Bugdoc <dateFields - BenSewell.doc> shows another problem in all language versions: (3) completely wrong date - "22 I can reproduce problems (1) and (3), but I can't reproduce problem (2). ad (1): The contributed patch solves problem (1). But it's not appropriate. The defect cause is that in method <GetWordDefaultDateStringAsUS(..)> a string replacement is performed - "YY" replaced by "YYYY". Thus, variable <sParams> could contain the string "DD/MM/YYYYYY", which isn't correct. Thus, method <GetWordDefaultDateStringAsUS(..)> should be adjusted. ad (3) The defect cause is that the format string isn't correctly parsed. I'm still investigating.
ad (3): Finished investigation. Yes, the data format is enclosed in brackets represented by unicodes 0x201C and 0x201D, which are recognized in the string parsing method <FindPara(..)>
@od: To reproduce (2): In Word, 1) insert a dynamic date field (Insertion>Date et heure, check "Mettre à jour automatiquement", choose "5 janvier 2007" and click "Ok") 2) Save the file 3) Open with OOo 2.1 4) Read : d janvier yyyy
OD->manens: Do you used a French Microsoft Office? (I've got only an English version) Which version of Microsoft Office do you used? (I've got only Microsoft Office 2003) Can you please attach the created Microsoft Word document. Which language do you have in your OOo 2.1?
manens -> od Yes, I use a French Microsoft Office XP SP3 on windows XP SP2 > Which language do you have in your OOo 2.1 ? I use a french only version of OOo 2.1 I can reproduce the bug with OOo too (see date_ooo.doc): 1) Create a new writer file 2) Insertion>Champs>Autres...>Document>Date>Date>31 décembre 1999 3) Save as Microsoft Word 97/2000/XP 4) Close document 5) Open with OOo and read : d janvier yyyy 6) Open with word and read : 5 janvier 2007 see attached file
Created attachment 41907 [details] File with a date field created with MS word XP SP3
Created attachment 41908 [details] File with a date field created with OOo 2.1
OD->manens: Thx a lot. With your documents I can reproduce problem (2). Can you reproduce problem (2) with attached document <dateFields.doc>?
manens -> od No, I can't reproduce the problem with <dateFields.doc> and OOo 2.1 win or OOo 2.0.3 Linux.
As it looks the provided patch can't be used as it is. So to me it looks as if we should mark this as a duplicate of issue 29646 (or vice versa).
Any news on this issue? What's the current state?
OD->mloiseleur: Please adjust your patch according my first comment on 2007-01-05 - method <GetWordDefaultDateStringAsUS(..)> should be adjusted. If you don't want to do this adjustment, please assign this issue back to me. Then I will take care of the needed changes. Thx in advance.
Created attachment 42729 [details] Clean Fix to date problem
Here is the patch. Can you validate and merge it, please ? Sorry for the delay, I hope I can be faster next time.
od: I have adjusted my patch. Can you confirm it is correct and merge to the CVS, please ? Thanks in advance
ccing me - Sophie
OD->mloiseleur: That's the fix I was looking for. Thx for your contribution. This will solve problem (1) - see my comment from 2007-01-05. I will use this issue to solve problem (1) with the newly provided patch from mloiseleur, target OOo 2.3. Problem (2) is already described in issue 29646. For problem (3) I will submit a new issue.
Created attachment 42940 [details] document to reproduce the described defect (1)
I've attached Microsoft Word document - wrong-imported-dateFields.doc. Open this document in OpenOffice.org to reproduce the described defect (1), regardless of the language of the OpenOffice.org version.
commited fix to cws swqbf93 - changed files: /sw/source/filter/ww8/ww8par5.cxx, 1.98.24.1
Thanks so much for fixing that issue that was really a pain when users were migrating there documents!
OD->MRU: Checked in internal installation set of cws swqbf93 - please verify. Note: Defect (1) - see my comment from 2007-01-05 - has been fixed. Attached document <wrong-imported-dateFields.doc> can be used to reproduce and verify the fix.
Verified fix in CWS swqbf93. Just to make one thing clear: the problem, that some date fields are imported as "dd June yyyy" is handled in issue 29646.
Checked in 680m214.
I just tested with OOo 2.3 in French the last example document, and the defect is still there for the hour (see screenshots). Please could someone confirm this issue? Please, also open the attached document below to see that there are still dates in chinese.
Created attachment 48889 [details] the od document with Word XP
Created attachment 48890 [details] od document under OOo 2.3 fr
Created attachment 48891 [details] The document to test fields converted to chinese
Created attachment 48892 [details] word doc
Created attachment 48893 [details] The document with OOo 2.3 fr
No problem to open the bugdoc in OO 2.3. For remaining languages, we have already filed a follow up bug (issue 79388). There are only listed some languages which do not work. Feel free to add your chinese document there. Thanks for your patience.
Closed.
MRU->pagalmes: You could also file a new issue regarding that a time field is not converted - this issue here fixed the fact, that a date field was imported in an "unreadable" format.
All the date fields issues are not solved, see: - issue 82680: "WW8: French date field wrongly imported as Japanese format" - issue 82679: "WW8: time field imported as date field" - issue 79388: "WW8: Italian, Spanish, Portuguese date formats converted to "June yyyy"