Class PicturesTable
Word stores images as is within so called "Data stream" - the stream within a Word docfile containing various data that hang off of characters in the main stream. For example, binary data describing in-line pictures and/or formfields an also embedded objects-native data. Word picture structures are concatenated one after the other in the data stream if the document contains pictures. Data stream is easily reachable via HWPFDocument._dataStream property. A picture is represented in the document text stream as a special character, an Unicode whose CharacterRun.isSpecial() returns true. The file location of the picture in the Word binary file is accessed via CharacterRun.getPicOffset(). The CharacterRun.getPicOffset() is a byte offset into the data stream. Beginning at the position recorded in picOffset, a header data structure, will be stored.
-
Constructor Summary
ConstructorsConstructorDescriptionPicturesTable(HWPFDocument _document, byte[] _dataStream, byte[] _mainStream) PicturesTable(HWPFDocument _document, byte[] _dataStream, byte[] _mainStream, FSPATable fspa, OfficeArtContent dgg) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionextractPicture(CharacterRun run, boolean fillBytes) Returns picture object tied to specified CharacterRunNot all documents have all the images concatenated in the data stream although MS claims so.booleanbooleandetermines whether specified CharacterRun contains reference to a picturebooleanhasPicture(CharacterRun run) determines whether specified CharacterRun contains reference to a picture
-
Constructor Details
-
PicturesTable
@Deprecated public PicturesTable(HWPFDocument _document, byte[] _dataStream, byte[] _mainStream, FSPATable fspa, OfficeArtContent dgg) Deprecated. -
PicturesTable
-
-
Method Details
-
hasPicture
determines whether specified CharacterRun contains reference to a picture -
hasEscherPicture
-
hasHorizontalLine
determines whether specified CharacterRun contains reference to a picture -
extractPicture
Returns picture object tied to specified CharacterRun- Parameters:
fillBytes- if true, Picture will be returned with filled byte array that represent picture's contents. If you don't want to have that byte array in memory but only write picture's contents to stream, pass false and then use Picture.writeImageContent- Returns:
- a Picture object if picture exists for specified CharacterRun, null otherwise. PicturesTable.hasPicture is used to determine this.
- See Also:
-
getAllPictures
Not all documents have all the images concatenated in the data stream although MS claims so. The best approach is to scan all character runs.- Returns:
- a list of Picture objects found in current document
-