You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Daniel Noll <da...@nuix.com.au> on 2006/01/23 06:50:50 UTC

PowerPoint comments

Hi all.

I created a simple PowerPoint document with some comments in it so that 
I could poke around the API and try to figure out where the comments 
were stored.  I started to think that the class called Notes in the API 
stored the PowerPoint comments.

My code is currently fairly simple:

    HSLFSlideShow hslfSlideShow = new HSLFSlideShow(fileSystem);
    SlideShow slideShow = new SlideShow(hslfSlideShow);
    for (Notes note : slideShow.getNotes()) {
        System.out.println("Note: " + note);
    }

Nothing prints, though.  Are notes what I think they are?  From reading 
the source, it does look like reading the notes has been implemented, so 
perhaps comments are actually something else.

Daniel

-- 
Daniel Noll

Nuix Australia Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia
Phone: (02) 9280 0699
Fax:   (02) 9212 6902

This message is intended only for the named recipient. If you are not
the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
message or attachment is strictly prohibited.


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: PowerPoint comments

Posted by Daniel Noll <da...@nuix.com.au>.
Nick Burch wrote:
>> FYI, at a low level comments are handled completely differently in
>> PP97/2000 than XP/2003. Comments created in XP/2003 will not be 
>> visible in
>> earlier versions.
> 
> Oh, joy....
> 
> Could someone with PPT 97 please do me two single page PPT files (one 
> with a single comment, and one without, but otherwise the same)?
> 
> Chuck them on bugzilla, then we can start looking into the differences 
> between them.

It seems that comments in PowerPoint 97 are not only stored in Escher 
textboxes, but the comments are even visible during a slide show which 
means that they really *are* just normal textboxes.

I just tested this case using the HSLF's existing PowerPoint text 
extractor, and indeed the text of all the comments is already extracted. 
  (Good news for me... one less thing I have to go and write.)

Daniel


-- 
Daniel Noll

Nuix Australia Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia
Phone: (02) 9280 0699
Fax:   (02) 9212 6902

This message is intended only for the named recipient. If you are not
the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
message or attachment is strictly prohibited.

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: PowerPoint comments

Posted by Nick Burch <ni...@torchbox.com>.
On Tue, 24 Jan 2006, Chris Nokleberg wrote:
> On Tue, 24 Jan 2006 09:53:50 +1100, Daniel Noll wrote:
>> Nick Burch wrote:
>>> I'm not sure exactly what you mean by "comments", could you describe
>>> how to add them in powerpoint?
>>>
>> Insert menu, Comments.  It adds a sort of sticky note where you can
>> enter comments, and there can be multiple sticky notes from multiple
>> users on a single sheet.
>
> FYI, at a low level comments are handled completely differently in
> PP97/2000 than XP/2003. Comments created in XP/2003 will not be visible in
> earlier versions.

Oh, joy....

Could someone with PPT 97 please do me two single page PPT files (one with 
a single comment, and one without, but otherwise the same)?

Chuck them on bugzilla, then we can start looking into the differences 
between them.

Cheers
Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: PowerPoint comments

Posted by Chris Nokleberg <ch...@sixlegs.com>.
On Tue, 24 Jan 2006 09:53:50 +1100, Daniel Noll wrote:

> Nick Burch wrote:
>> I'm not sure exactly what you mean by "comments", could you describe 
>> how to add them in powerpoint?
>>
> Insert menu, Comments.  It adds a sort of sticky note where you can 
> enter comments, and there can be multiple sticky notes from multiple 
> users on a single sheet.

FYI, at a low level comments are handled completely differently in
PP97/2000 than XP/2003. Comments created in XP/2003 will not be visible in
earlier versions.

Chris



---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: PowerPoint comments

Posted by Daniel Noll <da...@nuix.com.au>.
Nick Burch wrote:
> I'm not sure exactly what you mean by "comments", could you describe 
> how to add them in powerpoint?
>
Insert menu, Comments.  It adds a sort of sticky note where you can 
enter comments, and there can be multiple sticky notes from multiple 
users on a single sheet.
> To figure out the record(s) for a comment, do the following:
> * take a single page PPT document without them
> * save it via "save as" (this ensures it doesn't do an update/partial
>    save, which leads to more complex record ordering + record 
> duplication)
> * add in a single comment
> * save it via "save as"
> * compare the output of the various org.apache.poi.hslf.dev classes
>    (either PPTXMLDump, or SlideShowDumper, depending on which format you
>     find easier to understand)
> * see what new records have shown up
Okay, I see a few things.
  - A new VBAInfo inside a List up near the top of the output.
  - Extra binary data in a BinaryTagData directly below the VBAInfo, 
which contains the text of my name.
  - Extra binary data in a BinaryTagData inside the slide itself, which 
contains the text of the comment.

The good news is, the comment is beneath the Slide it belongs to 
(although I can't instantly see how to figure out which bits are text.)

The bad news is when I added a second comment and saved that to create a 
third document, I couldn't see the text of that second comment anywhere 
in the diff from the output for a single comment.

Daniel

-- 
Daniel Noll

Nuix Australia Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia
Phone: (02) 9280 0699
Fax:   (02) 9212 6902

This message is intended only for the named recipient. If you are not
the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
message or attachment is strictly prohibited.


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: PowerPoint comments

Posted by Nick Burch <ni...@torchbox.com>.
On Mon, 6 Feb 2006, Daniel Noll wrote:
> Nick Burch wrote:
>>> Recent insight tells me that these are probably the coordinates of the
>>> comment with respect to the top left corner of the slide. :-)
>> 
>> Well done for figuring it all out!
>> 
>> I'd be keen to get code for this into POI. Have you written record code
>> for it? (I'm happy to write record code based on your descriptions of the
>> records, just don't want to duplicate your work)
>
> I have done record code for Comment (and CString)

Ah. You may've seen I committed code for those this afternoon, having 
noticed they'd be nice and quick. I'll look forward to the CommentAtom 
stuff, I promise not to duplicate the work on that!

> If you sit tight for a bit longer I should be able to give you the code 
> I've got, I just have to get the stamp from the boss (the odds look 
> pretty good at present.)

Great. We'll also need a declaration from you, but I think Andrew has 
emailed you about it.

Also, it'd be great if you could write up some documentation on how the 
comment records stuff works. Our current documentation on stuff that isn't 
documented / not as per public documentation lives in
   src/documentation/content/xdocs/hslf/ppt-file-format.xml

If you do fancy writing something for there, that'd be great

Thanks
Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: PowerPoint comments

Posted by Daniel Noll <da...@nuix.com.au>.
Nick Burch wrote:
>> Recent insight tells me that these are probably the coordinates of the
>> comment with respect to the top left corner of the slide. :-)
> 
> Well done for figuring it all out!
> 
> I'd be keen to get code for this into POI. Have you written record code
> for it? (I'm happy to write record code based on your descriptions of the
> records, just don't want to duplicate your work)

I have done record code for Comment (and CString) but not yet this stuff 
which would go into a CommentAtom class.  The only information we need 
from the atom is the date, but apparently the date is much lower 
priority than the text itself (we're using this content for searching, 
and dates mixed amongst text are problematic due to timezones.)

If you sit tight for a bit longer I should be able to give you the code 
I've got, I just have to get the stamp from the boss (the odds look 
pretty good at present.)

Daniel

-- 
Daniel Noll

Nuix Australia Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia
Phone: (02) 9280 0699
Fax:   (02) 9212 6902

This message is intended only for the named recipient. If you are not
the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
message or attachment is strictly prohibited.

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: PowerPoint comments

Posted by Nick Burch <ni...@torchbox.com>.
On Tue, 31 Jan 2006, Daniel Noll wrote:
> Daniel Noll wrote:
> >   0a 00 00 00     ?
> >   0a 00 00 00     ?
> >
> > The last two integers seem to be identical on all the comments I tested
> > today (actually, every comment has different values, but the two values
> > were equal to each other) but I've seen them being different on my
> > original test comments.  I can't immediately see what they mean, but
> > perhaps this data can just be left sitting around as a byte[] once the
> > other data is parsed out.
>
> Recent insight tells me that these are probably the coordinates of the
> comment with respect to the top left corner of the slide. :-)

Well done for figuring it all out!

I'd be keen to get code for this into POI. Have you written record code
for it? (I'm happy to write record code based on your descriptions of the
records, just don't want to duplicate your work)

Cheers
Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: PowerPoint comments

Posted by Daniel Noll <da...@nuix.com.au>.
Daniel Noll wrote:
>   0a 00 00 00     ?
>   0a 00 00 00     ?
> 
> The last two integers seem to be identical on all the comments I tested 
> today (actually, every comment has different values, but the two values 
> were equal to each other) but I've seen them being different on my 
> original test comments.  I can't immediately see what they mean, but 
> perhaps this data can just be left sitting around as a byte[] once the 
> other data is parsed out.

Ah.

Recent insight tells me that these are probably the coordinates of the 
comment with respect to the top left corner of the slide. :-)

Daniel


-- 
Daniel Noll

Nuix Australia Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia
Phone: (02) 9280 0699
Fax:   (02) 9212 6902

This message is intended only for the named recipient. If you are not
the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
message or attachment is strictly prohibited.

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: PowerPoint comments

Posted by Daniel Noll <da...@nuix.com.au>.
Daniel Noll wrote:
>  00 00 e1 2e 1c 00 00 00    Record, type = 12001, length = 28
>  Next 28 bytes are god-knows what, but I'm thinking the comment date
>  has to be in here somewhere as PowerPoint knows what time the comment
>  was added.
>      01 00 00 00 d6 07 01 00 02 00 18 00 10 00 0e 00
>      34 00 d4 01 0a 00 00 00 0a 00 00 00

Disassembling this a bit:

   First four bytes:
   01 00 00 00     = 1 (comment number?  It was 2, 3, 4 on the next three
                        comments.)

   Next 16 bytes is a datetime structure:
   d6 07           = 2006 (year)
   01 00           = 1 (month, January)
   02 00           = 2 (day of week?  comment was made on Tuesday.)
   18 00           = 24 (day of month)
   10 00           = 16 (hour)
   0e 00           = 14 (minute)
   34 00           = 52 (second)
   d4 01           = 468 (milliseconds??)
   0a 00 00 00     ?
   0a 00 00 00     ?

Does this look about right?  I've never seen an application store dates 
in such a fashion.  As ACSII, yes... as 64-bit little-endian numbers, 
yes... but not like this.

The last two integers seem to be identical on all the comments I tested 
today (actually, every comment has different values, but the two values 
were equal to each other) but I've seen them being different on my 
original test comments.  I can't immediately see what they mean, but 
perhaps this data can just be left sitting around as a byte[] once the 
other data is parsed out.

Knowing my luck, HSLF already has some logic somewhere for converting 
this structure into a Java date and I just wasted my time. ;-)

I probably should bring this thread over to the dev list anyway, huh... 
most of the people here probably don't care about how PowerPoint stores 
its wacky dates. :-)

Daniel


-- 
Daniel Noll

Nuix Australia Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia
Phone: (02) 9280 0699
Fax:   (02) 9212 6902

This message is intended only for the named recipient. If you are not
the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
message or attachment is strictly prohibited.

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: PowerPoint comments

Posted by Daniel Noll <da...@nuix.com.au>.
Nick Burch wrote:
> On Tue, 24 Jan 2006, Nick Burch wrote:
>> Alas, all the documentation I can find on BinaryTagData is "The value 
>> of PST_ProgBinaryTag is the size of the binary data.", which isn't 
>> much help
>
> I've just noticed within the slide one:
>
> (8 byte record header)
> 0F 00 E0 2E A2 00 00 00 Container record
>  00 00 BA 0F 14 00 00 00 (0x14=20 bytes of who made the edit, in unicode)
>  10 00 BA 0F 50 00 00 00 (0x50=80 bytes of the comment text, in unicode)
>  20 00 BA 0F 02 00 00 00 44 00
>  00 00 E1 2E 1C 00 00 00 (0x1c=28 bytes of data)
>
> E0 2E -> 2E E0 = 12000 = ?
> BA 0F -> 0F BA = 4026 = CString, so this is looking quite possible
> E1 2E -> 2E E1 = 12001 = ?
>
> Looks like it's a nested structure of records. I'm not sure how we'd 
> tell it's comments though, I guess just trial and error looking at the 
> sub records
Yeah.  I see the same structure too, I was disassembling it last night.

  0f 00 e0 2e 7c 00 00 00    Container record, type = 12000, length = 124

  00 00 ba 0f 16 00 00 00    Record, type = 4026 (CString), length = 22
  Next 22 bytes is the name of the person who made the comment.

  10 00 ba 0f 24 00 00 00    Record, type = 4026 (CString), length = 36
  Next 36 bytes is the text of the comment.

  20 00 ba 0f 06 00 00 00    Record, type = 4026 (CString), length = 6
  Next 6 bytes are the initials of the person who made the comment.

  00 00 e1 2e 1c 00 00 00    Record, type = 12001, length = 28
  Next 28 bytes are god-knows what, but I'm thinking the comment date
  has to be in here somewhere as PowerPoint knows what time the comment
  was added.
      01 00 00 00 d6 07 01 00 02 00 18 00 10 00 0e 00
      34 00 d4 01 0a 00 00 00 0a 00 00 00

Type 12000 must be a comment container.  Judging from the way other such
containers are laid out, could 12001 be a comment atom?

Mystery 1:
  The "00 00", "01 00", "02 00" that appear in the header for the
  CString records... I have no idea what the first short value in a
  record header means, but they're always the same for comments as
  far as I can see.

Mystery 2:
  This final block which is at the end of the other comment records:
    00 00 eb 2e 08 00 00 00     type = 12011, length = 8
    a5 20 c6 01 90 f0 f3 11

Daniel

-- 
Daniel Noll

Nuix Australia Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia
Phone: (02) 9280 0699
Fax:   (02) 9212 6902

This message is intended only for the named recipient. If you are not
the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
message or attachment is strictly prohibited.


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: PowerPoint comments

Posted by Nick Burch <ni...@torchbox.com>.
On Tue, 24 Jan 2006, Nick Burch wrote:
> Alas, all the documentation I can find on BinaryTagData is "The value of 
> PST_ProgBinaryTag is the size of the binary data.", which isn't much help

I've just noticed within the slide one:

(8 byte record header)
0F 00 E0 2E A2 00 00 00 Container record
  00 00 BA 0F 14 00 00 00 (0x14=20 bytes of who made the edit, in unicode)
  10 00 BA 0F 50 00 00 00 (0x50=80 bytes of the comment text, in unicode)
  20 00 BA 0F 02 00 00 00 44 00
  00 00 E1 2E 1C 00 00 00 (0x1c=28 bytes of data)

E0 2E -> 2E E0 = 12000 = ?
BA 0F -> 0F BA = 4026 = CString, so this is looking quite possible
E1 2E -> 2E E1 = 12001 = ?

Looks like it's a nested structure of records. I'm not sure how we'd tell 
it's comments though, I guess just trial and error looking at the sub 
records


Can anyone confirm if they see the same data structure?

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: PowerPoint comments

Posted by Nick Burch <ni...@torchbox.com>.
On Tue, 24 Jan 2006, Daniel Noll wrote:
> Digging through the object graph using a debugger now, and getting somewhere 
> perhaps a little more useful than comparing dumps.

Armed with your description of comments, I've been able to set up a file 
with them in

I then ran org.apache.poi.hslf.dev.SlideShowDumper against the file with 
and without, then compared the two dumps with xdiff


I can confirm that under Document->List->ProgTags (type 
5000)->ProgBinaryTag (type 5002), the BinaryTagData (type 5003) was 
altered

Then, under the Slide->ProgTags->ProgBinaryTag, the BinaryTagData was also 
updated


So, looks like you are probably correct in guessing that who made the 
comment is in the BinaryTagData under document (and with the time of the 
edit?), and the comment itself is under the BinaryTagData of the Slide

Alas, all the documentation I can find on BinaryTagData is "The value of 
PST_ProgBinaryTag is the size of the binary data.", which isn't much help


Do let us know how you get on with understanding the contents of it!

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: PowerPoint comments

Posted by Daniel Noll <da...@nuix.com.au>.
Okay...

Digging through the object graph using a debugger now, and getting 
somewhere perhaps a little more useful than comparing dumps.

Looking at the most recent code records in a SlideShow, index 2 is the 
hslf.record.Slide for the single slide in my spreadsheet.

The child record of the slide at index 3 contains the text of the 
comments I added, and the record in question has type 5000.  Now to 
figure out how this is laid out...

Daniel

-- 
Daniel Noll

Nuix Australia Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia
Phone: (02) 9280 0699
Fax:   (02) 9212 6902

This message is intended only for the named recipient. If you are not
the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
message or attachment is strictly prohibited.


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: PowerPoint comments

Posted by Nick Burch <ni...@torchbox.com>.
On Mon, 23 Jan 2006, Daniel Noll wrote:
>> I created a simple PowerPoint document with some comments in it so that I 
>> could poke around the API and try to figure out where the comments were 
>> stored.  I started to think that the class called Notes in the API stored 
>> the PowerPoint comments.
> Okay, I understand now that this was wrong. :-)

Yup. Notes are the notes for a slide (that sit underneath the main slide)

> But I still do need to get at the comments.  Does anyone have some 
> pointers to some documentation so that I might try adding comment 
> extraction support to HSLF?

I'm not sure exactly what you mean by "comments", could you describe how 
to add them in powerpoint?

To figure out the record(s) for a comment, do the following:
* take a single page PPT document without them
* save it via "save as" (this ensures it doesn't do an update/partial
    save, which leads to more complex record ordering + record duplication)
* add in a single comment
* save it via "save as"
* compare the output of the various org.apache.poi.hslf.dev classes
    (either PPTXMLDump, or SlideShowDumper, depending on which format you
     find easier to understand)
* see what new records have shown up

If you can't make sense of these, then open a new bugzilla entry, and 
attach these two PPT files. I can then take a look, and let you know what 
areas to look in

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: PowerPoint comments

Posted by Daniel Noll <da...@nuix.com.au>.
Daniel Noll wrote:
> Hi all.
>
> I created a simple PowerPoint document with some comments in it so 
> that I could poke around the API and try to figure out where the 
> comments were stored.  I started to think that the class called Notes 
> in the API stored the PowerPoint comments.
Okay, I understand now that this was wrong. :-)

But I still do need to get at the comments.  Does anyone have some 
pointers to some documentation so that I might try adding comment 
extraction support to HSLF?

Daniel

-- 
Daniel Noll

Nuix Australia Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia
Phone: (02) 9280 0699
Fax:   (02) 9212 6902

This message is intended only for the named recipient. If you are not
the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
message or attachment is strictly prohibited.


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/