Thanks David,
I assumed that WordPerfect, like MS Office, saves the Revision date in the actual document somewhere.
So it seems that not all the Document Summary fields that WordPerfect allows you to Add/Remove are
actually part of the the Metadada. J
I think that they are all there in the metadata, or can be (see below). It even stores a Revision Date field that is always blank, as it uses the OS modification date/time as I said in the earlier email.
Im still wondering why WordPerfect doesnt store anything (anymore) in the 1st part of the DocSumm packet,
where the CreationDate use to be (26 bytes + null). If I had to guess, I would say that when v5.0 of the format was
being considered it might have been intended for the CreationDate, but the formated version maybe?
Tuesday Oct. 15, 1956 1:36 PM. Not sure though.
Is it safe to say that version 5.0 does not have (or no longer has) CreationDate saved as part of the Metadata?
I ask this cause WordPerfect 10 does not use the 1st 26 bytes for the date when saving the Metadata.
Maybe earlier versions did ?!?
I don't really understand this. I ran both the documents you supplied through my hacked wpd2info:
[EMAIL PROTECTED] text]$ ./wpd2text --info /tmp/How\ to\ Read\ Creation\ Date.wpd
Unknown metadata type = 2
Unknown metadata type = 39
Unknown metadata type = 48 Me Also
creation-date Mon May 1 13:02:35 2007
dc:creator Me
dc:subject How to Read Creation Date, Revision Date.
libwpd:abstract
libwpd:descriptive-name Read Creation Date, Revision Date.
libwpd:descriptive-type
libwpd:keywords
[EMAIL PROTECTED] text]$ ./wpd2text --info /tmp/wp50.wpd
Unknown metadata type = 2
Unknown metadata type = 39
Unknown metadata type = 48 Me Also
creation-date Mon May 1 13:02:35 2007
dc:creator Me
dc:subject How to Read Creation Date, Revision Date.
libwpd:abstract
libwpd:descriptive-name Read Creation Date, Revision Date.
libwpd:descriptive-type
libwpd:keywords
The first three tags are
Tag 2: Account
Tag 39: Revision Date (always blank)
Tag 48: Typist
libwpd seems to recognise everything OK.
regards - David
Thanks for all the help guys.
Ismail.
From: David Hislop [ mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 09, 2007 9:18 AM
To: Ismail Ibric; libwpd-devel@lists.sourceforge.net
Subject: Re: [Libwpd-devel] WPD 5 file structure
Ismail,
I hope to have something done on this soon. I've already modified the --info code to display the creation date, but it was a quick hack. Need to do it properly, but the existing code already supports reading the date, so it wasn't too hard. I've been away for a while, and should get back to it later this week.
A couple of things:
1. WordPerfect doesn't store the Revision Date. It uses the mod date of the file from the OS.
2. The Document Summary fields you can add and remove are stored just like any other Document Summary field. I have some in one of my documents that aren't supported by the current libwpd, e.g. typist, but I dropped in some default code to indicate their presence. I'll remove that code and in future if I get a chance try out some real code to handle those configurable fields.
regards - David
At 02:08 pm 08/05/2007, Ismail Ibric wrote:
Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C79126.7E0446EC"
Sorry,
In my last email, the attached WPD is actually WordPervect 6+ :p
When I was trying to save it as 5.0, I tried to change the extension to also read .WPD
WordPerfect took this to mean that I made a mistake in the Format I chose and just used 6+.
I figured out most of the structure, and that I cant read SHORT and UINT just as is,
but have to read them in Byte by Byte.
So far I can parse all 5 Packets, (in each special header), and can find Packet Type 1, (DocumentSummary).
I figured out that even in v5.0 the Descriptive Name is 68 (no Null at end), and the remainder of the string is the
Descriptive Type. (same applies to v5.1)
I got as far as reading in the Creation Date, but only in v5.1,,, since it has those 2 FormatMarkers surronding the date.
Version 5.0 did not have the 2 FormatMarkers and no date (date is 10 bytes)
The thing is, when I reopen the .WP document again, WordPerfect somehow retains the Creation date, and Revision date.
I tried saving a copy of the origianl, just so I can see the Revision bytes change and used a Binary Comparision tool.
It seems that Packet 6 (Document Specific flags) is the one that significatly changes.
There is no documentation on how WordPerfect stores the Creation date, Revision dates for v5.0 but it gets it somehow.
Could WordPerfect be using bits, instead of bytes, to represent the Date?
0000 0000 0000 0000 (SHORT representation)
day(0-4) month(5-9) year(10-15)
Any thoughts?
Thanks,
Ismail.
P.S.
WordPerfect allows the user to add or remove Document Summary fields
Where would those go? (in a certain Packet?)
From: [EMAIL PROTECTED] [ mailto:[EMAIL PROTECTED]] On Behalf Of Ismail Ibric
Sent: Thursday, May 03, 2007 8:02 PM
To: libwpd-devel@lists.sourceforge.net
Subject: [Libwpd-devel] WPD 5 file structure
Im wondering about the Structure of a WPD 5 document.
I searched and found WPD 5.1 Document Format info online.
The Header and the Special Header seem to be correct,
But the Packet has garbage.
Here are the Stucts that I con-struct-ed. J
typedef struct tagWPD_HDR
{
CHAR reserved1;
CHAR WPC[3];
UINT DocAreaPos;
BYTE ProductType;
BYTE FileType;
BYTE MajorVer;
BYTE MinorVer;
USHORT Encrytped;
USHORT reserved2;
}WPD_HDR;
typedef struct tagWPD_SP_HDR
{
UINT PacketCount;
UINT Size;
UINT NextPacketPos;
}WPD_SP_HDR;
typedef struct tagWPD_PACKET
{
USHORT PacketType;
USHORT PacketLen;
USHORT NextPacketPos;
}WPD_PACKET;
void main( )
{
WPD_HDR header = {0};
WPD_SP_HDR sp_hdr = {0};
WPD_PACKET packet = {0};
UINT filepos = 0;
//read whole WPD into buffer
//will revise later to seek and read into struct
memcpy( &header, buffer, sizeof(header) );
filepos += sizeof(header);
if( header.ProductType != 1 && header.FileType != 10)
goto EndOfFunction;
memcpy( &sp_hdr, buffer + filepos, sizeof(sp_hdr) );
filepos += sizeof(sp_hdr);
memcpy( &packet, buffer + filepos, sizeof(packet) );
filepos += sizeof(packet);
//Break Here and look whats in the Structs
EndOfFunction:
//free memory and close handles (files, etc..)
}
The header looks like this:
- reserved1 -1
- WPC WPC
- DocAreaPos 30452
- ProductType 1
- FileType 10
- MajorVersion 2
- MinorVersion 1
- Encrypted 0
- reserved2 512
The sp_hdr looks like this:
- PacketCount 5
- Size 30897 (matches the filesize)
- NextPacketPos 512
The packet looks like this:
- PacketType 16586
- PacketLen 31909
- NextPacketPos 33850
I must be mistaken, as far as the WPD_PACKET struct is concerned
Whats the correct way to read the Packets, any thoughts?
Attached is the WPD I was playing with.
Thanks,
Ismail.
------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/
_______________________________________________ Libwpd-devel mailing list Libwpd-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libwpd-devel