poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Gutjahr <org.apache....@charlesgutjahr.com>
Subject Proposed RSID patch for HWPF
Date Thu, 07 Apr 2011 13:01:20 GMT

Hi

I'm just starting to use POI for generating HWPF Word documents There are two features that
I need which I think should be included in POI; and since I need them I figure I might as
well build them and contribute patches. I'd like to get some advice and a yea or nay before
I go ahead 


The first one is about RSIDs. This started with my question at http://stackoverflow.com/questions/4966087/how-to-generate-rsid-attributes-correctly-in-word-docx-files-using-apache-poi

My application is generating HWPF documents which a number of user will download, edit using
Word, then upload back into the system. At the moment we simply overwrite the generated document
with user's changes; but it would be more useful if the application could identify what has
changed. That's exactly why Word has revision identifiers (RSIDs): they identify all the changes
made in one session thus making it easy to identify changes. A document created by Word is
full of RSIDs, whereas a document created by POI doesn't have any.


I'd like to add the ability for POI to automatically assign RSIDs to HWPF documents. Here's
a rough plan of what I'm thinking about implementing:
 * Add properties to XWPFDocument that store the base RSID, all RSIDs in use the document,
and a RSID being used for the current revision.
 * Add appropriate methods to get, set and clear those XWPFDocument properties
 * The base RSID and other RSIDs in XWPFDocument will be populated from word/settings.xml
when an existing document is loaded
 * The current session RSID will be randomly generated automatically when a XWPFDocument
object is constructed. This means that a 'revision' will be defined as the lifetime of that
instance.
 * Paragraphs, runs and other content will have appropriate methods to get, set and clear
the RSID
 * Add a boolean property (and associated methods) that enables and disables automatic assignment
of an RSID to new paragrams, runs, etc added by POI. This will probably be disabled by default.
 * When that boolean is enabled, any method that creates new context will automatically assign
the current RSID to that content (for example XWPFDocument.createParagraph(), XWPFParagraph.createRun(),
XWPFRun.setText() etc)


Does anyone have any comments on or objections to that plan? And should I put this in bugzilla?


I have another need for POI, I will write that one up in my next email...

Cheers
Charlie


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
    • Unnamed multipart/related (inline, None, 0 bytes)
View raw message