Serializable Sections

Is there any chance of making the Aspose.Word.Section class serializable? The advantage is that I could then copy a section of a document (including all the text formatting, i.e. bolds, tables, etc) and store it in a database. Later I could retrieve that section from the database and ‘merge’ (well, section.insert) it into a new document.

Thanks

Jat

We will get there, not immediately, but certainly.

Aspose.Word will be able to save any fragment of the document as XML in WordprocessingML and/or XSL-FO format as well as in RTF.

We could potentially support binary serialization as well but I don’t think it is practical at this stage.

For the time being you could store .doc document with the section you want in a database binary field if you want to.

Hi Roman,

Saving the doc is a little inappropriate for our app. As a temporary measure, couldn’t you just make Aspose.Word.Section normal (binary) serializable, so that I can do the .Serialize & .Desearlize read/writes manually. I.e. set the class to <Serializable()> and .Net do all the hard work until the fragment stuff makes it in place.

Cheers,

Jat

Hi Jat,

It’s not that easy in my case because Section is just a tip of an iceberg. I will need to make a few dozen more private classes serializable and it will basically mean that whenever I release a new version all your documents serialized in the previous version could not be read. Obviously we could not support backward compatibility of all these intermediate binary formats.

OK I see your concerns.

Just curious - I don’t know how the word object model works, but I know that in RTF - a section is encapsulated in a ‘block’ of rtf. As such you simply insert a block of RTF (which is text) when you wish to insert a section.

Sure word files are binary, but judging that we have the capability to insert sections (before/after, etc), i’m guessing that ‘blocks’ of .doc file pertain to certain sections.

Thus, rather than serializing the object(s), is there anyway we could write out the section (saving it) as it would appear in the final file format as binary - i.e. rather than saving an entire document, just save a portion of the document (i.e. the binary for a section). Then that data can be loaded back into the document

I see where you heading. You are talking about saving just a section in Word binary format, right?

It will not work because Word format is not like this. There are many document-wide tables that describe what and were information is stored in the file and nothing is contained in a single place or block. In my opinion it is a total disaster file format. It is publicly available, have a look if you are interested http://www-aix.gsi.de/~bio/DOCS/wword8.html.

When it is inside Aspose.Word it is represented better and section is contained in a “block”. Yet it still can be referencing styles defined in a document-wide stylesheet and some drawings are also stored in a document-wide storage.

So the most viable solution will be to output in RTF or XML format which is what we want to do anyway.

Why don’t you want to store whole .doc in the database? You don’t have to store huge doc. Just leave the section you need and store it.

Roman - what is the rough timeframe for RTF implementation

May-June. We might get WordprocessingML support before RTF.