Issue 36594 - date field badly imported
Summary: date field badly imported
Status: CLOSED FIXED
Alias: None
Product: Writer
Classification: Application
Component: open-import (show other issues)
Version: OOo 1.1.2
Hardware: All All
: P3 Trivial with 5 votes (vote)
Target Milestone: ---
Assignee: michael.ruess
QA Contact: issues@sw
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-03 13:55 UTC by anowak
Modified: 2013-09-12 16:02 UTC (History)
5 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
samples of date fields badly imported in OOo (19.00 KB, application/msword)
2004-11-03 14:00 UTC, anowak
no flags Details
Demonstration of badly imported date fields (19.00 KB, application/msword)
2004-12-22 09:54 UTC, bensewell
no flags Details
The last attachment, loaded from DOC and saved in OO format (5.77 KB, application/vnd.sun.xml.writer)
2004-12-22 09:55 UTC, bensewell
no flags Details
A patch which fix the problem (387 bytes, text/plain)
2006-09-05 13:42 UTC, mloiseleur
no flags Details
Another fix for date created with no format under Ms Word. I believe it won't work for languages other than french, sadly. (410 bytes, text/plain)
2007-01-04 17:26 UTC, mloiseleur
no flags Details
File with a date field created with MS word XP SP3 (23.50 KB, application/msword)
2007-01-05 10:46 UTC, manens
no flags Details
File with a date field created with OOo 2.1 (62.00 KB, application/msword)
2007-01-05 10:47 UTC, manens
no flags Details
Clean Fix to date problem (663 bytes, text/plain)
2007-02-04 22:29 UTC, mloiseleur
no flags Details
document to reproduce the described defect (1) (23.50 KB, application/msword)
2007-02-12 09:08 UTC, Oliver-Rainer Wittmann
no flags Details
the od document with Word XP (6.13 KB, image/png)
2007-10-15 07:55 UTC, pagalmes.lists
no flags Details
od document under OOo 2.3 fr (3.30 KB, image/png)
2007-10-15 07:56 UTC, pagalmes.lists
no flags Details
The document to test fields converted to chinese (20.00 KB, application/vnd.sun.xml.writer)
2007-10-15 07:56 UTC, pagalmes.lists
no flags Details
word doc (8.52 KB, image/png)
2007-10-15 07:57 UTC, pagalmes.lists
no flags Details
The document with OOo 2.3 fr (6.68 KB, image/png)
2007-10-15 07:57 UTC, pagalmes.lists
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description anowak 2004-11-03 13:55:52 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)
Comment 1 anowak 2004-11-03 14:00:27 UTC
Created attachment 18879 [details]
samples of date fields badly imported in OOo
Comment 2 bensewell 2004-12-22 09:52:57 UTC
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).
Comment 3 bensewell 2004-12-22 09:54:27 UTC
Created attachment 20763 [details]
Demonstration of badly imported date fields
Comment 4 bensewell 2004-12-22 09:55:17 UTC
Created attachment 20764 [details]
The last attachment, loaded from DOC and saved in OO format
Comment 5 michael.ruess 2004-12-22 13:59:44 UTC
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.
Comment 6 martin_maher 2005-05-05 10:26:47 UTC
mmaher->flr: Your's methinks
Comment 7 mmenaz 2005-09-30 20:40:47 UTC
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
Comment 8 alci 2006-06-15 09:01:16 UTC
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 :-)
Comment 9 mloiseleur 2006-09-05 13:42:40 UTC
Created attachment 38967 [details]
A patch which fix the problem
Comment 10 mloiseleur 2006-09-05 13:50:28 UTC
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,

Comment 11 Martin Hollmichel 2007-01-02 11:11:00 UTC
set type to PATCH and reassign to PL
Comment 12 mloiseleur 2007-01-04 17:26:16 UTC
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.
Comment 13 mloiseleur 2007-01-04 17:31:21 UTC
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,
Comment 14 Oliver-Rainer Wittmann 2007-01-05 08:07:22 UTC
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.
Comment 15 Oliver-Rainer Wittmann 2007-01-05 08:26:35 UTC
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(..)>
Comment 16 manens 2007-01-05 08:57:13 UTC
@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
Comment 17 manens 2007-01-05 08:57:26 UTC
@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
Comment 18 Oliver-Rainer Wittmann 2007-01-05 10:13:57 UTC
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?
Comment 19 manens 2007-01-05 10:44:54 UTC
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
Comment 20 manens 2007-01-05 10:46:59 UTC
Created attachment 41907 [details]
File with a date field created with MS word XP SP3
Comment 21 manens 2007-01-05 10:47:26 UTC
Created attachment 41908 [details]
File with a date field created with OOo 2.1
Comment 22 Oliver-Rainer Wittmann 2007-01-05 11:06:32 UTC
OD->manens:
Thx a lot. With your documents I can reproduce problem (2).

Can you reproduce problem (2) with attached document <dateFields.doc>?
Comment 23 manens 2007-01-05 11:28:01 UTC
manens -> od

No, I can't reproduce the problem with <dateFields.doc> and OOo 2.1 win or OOo
2.0.3 Linux.
Comment 24 Mathias_Bauer 2007-01-08 09:55:47 UTC
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). 
Comment 25 Mathias_Bauer 2007-01-22 16:26:58 UTC
Any news on this issue? What's the current state?
Comment 26 Oliver-Rainer Wittmann 2007-01-23 13:54:50 UTC
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.
Comment 27 mloiseleur 2007-02-04 22:29:08 UTC
Created attachment 42729 [details]
Clean Fix to date problem
Comment 28 mloiseleur 2007-02-04 22:30:14 UTC
Here is the patch. Can you validate and merge it, please ?
Sorry for the delay, I hope I can be faster next time.
Comment 29 mloiseleur 2007-02-04 22:32:35 UTC
od: I have adjusted my patch. Can you confirm it is correct and merge to the
CVS, please ?

Thanks in advance
Comment 30 sgautier.ooo 2007-02-05 10:08:33 UTC
ccing me - Sophie
Comment 31 Oliver-Rainer Wittmann 2007-02-07 14:45:22 UTC
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.
Comment 32 Oliver-Rainer Wittmann 2007-02-12 09:08:48 UTC
Created attachment 42940 [details]
document to reproduce the described defect (1)
Comment 33 Oliver-Rainer Wittmann 2007-02-12 09:10:49 UTC
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.
Comment 34 Oliver-Rainer Wittmann 2007-02-12 09:47:16 UTC
commited fix to cws swqbf93 - changed files:
/sw/source/filter/ww8/ww8par5.cxx, 1.98.24.1
Comment 35 pagalmes.lists 2007-02-13 08:16:42 UTC
Thanks so much for fixing that issue that was really a pain when users were
migrating there documents!
Comment 36 Oliver-Rainer Wittmann 2007-04-24 14:07:47 UTC
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.
Comment 37 michael.ruess 2007-05-16 14:05:34 UTC
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.
Comment 38 michael.ruess 2007-06-21 15:17:05 UTC
Checked in 680m214.
Comment 39 pagalmes.lists 2007-10-15 07:54:52 UTC
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.
Comment 40 pagalmes.lists 2007-10-15 07:55:46 UTC
Created attachment 48889 [details]
the od document with Word XP
Comment 41 pagalmes.lists 2007-10-15 07:56:13 UTC
Created attachment 48890 [details]
od document under OOo 2.3 fr
Comment 42 pagalmes.lists 2007-10-15 07:56:48 UTC
Created attachment 48891 [details]
The document to test fields converted to chinese
Comment 43 pagalmes.lists 2007-10-15 07:57:13 UTC
Created attachment 48892 [details]
word doc
Comment 44 pagalmes.lists 2007-10-15 07:57:40 UTC
Created attachment 48893 [details]
The document with OOo 2.3 fr
Comment 45 michael.ruess 2007-10-15 12:04:24 UTC
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.
Comment 46 michael.ruess 2007-10-15 12:08:49 UTC
Closed.
Comment 47 michael.ruess 2007-10-15 12:12:21 UTC
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.
Comment 48 pagalmes.lists 2007-10-18 00:28:11 UTC
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"