public final class MSODrawing extends XLSRecord
offset name size contents
---
4 rgMSODr var MSO Drawing Data
The Msodrawing record represents the MSOFBTDGCONTAINER (0xF002) in the Drawing Layer (Escher) format, and contains all per-sheet
types of info, including the shapes themselves. (A shape=the elemental object that composes a drawing. All graphical figures on a
drawing are shapes). With few exceptions, shapes are stored hierachically according to how they've been grouped thru the use of
the Draw/Group command).
Each Msodrawing record contains several sub-records or atoms (atoms are records that are kept inside container records; container
records keep atoms and other container records organized).
There are several such records that are important to us (these are always present - except for MSOFBTDG in subsequent recs):
MSOFBTDG- Basic Drawing Info- #shapes in this drawing; last SPID given to an SP in this Drawing Group
MSOFBTSPGRCONTAINER- Patriarch shape Container - always first MSOFBTSPGRCONTAINER in the drawing container
MSOFBTSPCONTAINER- Shape Container
MSOFBTSP- Shape Atom Record- SPID= shape id + a set of flags
MSOFBTOPT- Property Table Record Associated with Shape Rec- holds image Name, index + many other properties
MSOFBTCLIENTANCHOR- Client Anchor rec- holds size/bounds info
MSOFBTCLIENTDATA- Host-specific client data record
There are many other records or atoms that are optional and that we will omit for now.
There appears to be 1 msodrawing record per image (there is also one OBJ record per Msodrawing record).
The first or header msodrawing record contains MSODBTDG for # shapes
There is one MsodrawingGroup record per file. This MsodrawingGroup record also contains sub-records that hold # shapes
Occasionally, when there is a lot of image data, there can be 2 MSODRAWINGGROUP objects -- continue recs will follow
the second MSODG only.
SPIDs are unique per drawing group, and are parceled out by the drawing group to individual drawings in blocks of 1024MSODrawingGroup,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static int |
COL |
static int |
COL1 |
static int |
COLOFFSET |
static int |
COLOFFSET1 |
static int |
OFFSETMAX |
static double |
PIXELCONVERSION |
byte[] |
PROTOTYPE_BYTES |
static int |
ROW |
static int |
ROW1 |
static int |
ROWOFFSET |
static int |
ROWOFFSET1 |
static double |
WCONVERSION |
static double |
XCONVERSION
Untested Info from Excel:
width/height in pixels = (w/h field - 8) * DPI of the display device / 72
DPI for Windows is 96 (Mac= 72)
thus conversion factor= 1.3333 for Windows devices
NOTES: seems correct for y/h, not for x/w
return coordinates as {X, Y, W, H} in pixels
|
col, continues, DEBUGLEVEL, hyperlink, idx, isBlank, isBoolean, isContinueMerged, isString, lastidx, myxf, offset, rw, streamer, wkbook, worksheetAI, ALLOWDUPES, ALRUNS, AREA, AREAFORMAT, ARRAY, ATTACHEDLABEL, AUTOFILTER, AXCENT, AXESUSED, AXIS, AXISLINEFORMAT, AXISPARENT, BACKUP, BAR, BEGIN, BLANK, BOF, BOOKBOOL, BOOLERR, BOPPOP, BOPPOPCUSTOM, BOTTOM_MARGIN, BOTTOMMARGIN, BOUNDSHEET, CALC_MODE_PROP, CALCCOUNT, CALCMODE, CALCULATE_ALWAYS, CALCULATE_AUTO, CALCULATE_EXPLICIT, CATLAB, CATSERRANGE, CF, CF12, CHART, CHART3DBARSHAPE, CHARTFORMAT, CHARTFORMATLINK, CHARTFRTINFO, CHARTLINE, CODENAME, COLINFO, CONDFMT, CONDFMT12, CONTINUE, COUNTRY, CRN, CRTLAYOUT12, CRTLAYOUT12A, DAT, DATAFORMAT, DATALABEXT, DATALABEXTCONTENTS, DATE1904, DBCELL, DCON, DCONBIN, DCONNAME, DCONREF, DEBUG_HIGH, DEBUG_LOW, DEBUG_MEDIUM, DEFAULTENCODING, DEFAULTROWHEIGHT, DEFAULTTEXT, DEFCOLWIDTH, DELTA, DIMENSIONS, DROPBAR, DSF, DV, DVAL, END, ENDBLOCK, ENDEXTSST, ENDOBJECT, EOF, EXCEL2K, EXTERNCOUNT, EXTERNNAME, EXTERNSHEET, EXTSST, FBI, FEATHEADR, FILE_LOCK, FILEPASS, FONT, FONTBASIS, FONTX, FOOTERREC, FORMAT, FORMULA, FRAME, FRTFONTLIST, FRTWRAPPER, GARBAGE, GELFRAME, GUTS, HCENTER, HEADERREC, HLINK, HORIZONTAL_PAGE_BREAKS, IFMT, INDEX, INTERFACE_HDR, ITERATION, LABEL, LABELSST, LEFT_MARGIN, LEFTMARGIN, LEGEND, LEGENDXN, LINE, LINEFORMAT, MARKERFORMAT, MAXCOLS, MAXCOLS_BIFF8, MAXRECLEN, MAXROWS, MAXROWS_BIFF8, MERGEDCELLS, MSODRAWING, MSODRAWINGGROUP, MSODRAWINGSELECTION, MULBLANK, MULRK, NAME, NOTE, NUMBER, OBJ, OBJECTLINK, OBJPROTECT, OBPROJ, PALETTE, PANE, PASSWORD, PHONETIC, PICF, PIE, PIEFORMAT, PIVOTCHARTBITS, PIVOTCHARTLINK, PLOTAREA, PLOTGROWTH, PLS, PLV, POS, PRECISION, PRINT_GRIDLINES, PRINT_ROW_HEADERS, PRINTGRID, PRINTROWCOL, PROT4REV, PROTECT, QSISXTAG, RADAR, RADARAREA, RANGEPROTECTION, REFMODE, REFTRACK_PROP, RIGHT_MARGIN, RIGHTMARGIN, RK, RRD_HEAD, RRD_INFO, RSTRING, RTENTEXU, RTMERGECELLS, SBASEREF, SCATTER, SCENPROTECT, SCL, SELECTION, SERAUXERRBAR, SERAUXTREND, SERFMT, SERIES, SERIESLIST, SERIESTEXT, SERPARENT, SERTOCRT, SETUP, SHAREDUPES, SHEETLAYOUT, SHEETPROTECTION, SHRFMLA, SHTPROPS, SIIINDEX, SST, STARTBLOCK, STARTOBJECT, STRING_ENCODING_AUTO, STRING_ENCODING_COMPRESSED, STRING_ENCODING_UNICODE, STRINGREC, STYLE, SUPBOOK, SURFACE, SXADDL, SXBOOL, SXDB, SXDBB, SXDBEX, SXDI, SXEX, SXFDB, SXFDBTYPE, SXFORMAT, SXIVD, SXLI, SXNUM, SXPI, SXSTREAMID, SXSTRING, SXVD, SXVDEX, SXVI, SXVIEW, SXVIEWEX9, SXVIEWLINK, SXVS, TABID, TABLE, TABLESTYLES, TEXTDISP, THREED, TICK, TOP_MARGIN, TOPMARGIN, TXO, TYPE_BLANK, TYPE_BOOLEAN, TYPE_DOUBLE, TYPE_FORMULA, TYPE_FP, TYPE_INT, TYPE_STRING, UNICODEENCODING, UNITS, USERBVIEW, USERSVIEWBEGIN, USERSVIEWEND, USETEMPFILE_PROP, USR_EXCL, VALIDATEWORKBOOK, VALUERANGE, VB_MODULE, VCENTER, VERTICAL_PAGE_BREAKS, WINDOW_PROTECT, WINDOW1, WINDOW2, WK_CHART, WK_FILE, WK_GLOBALS, WK_MACROSHEET, WK_WORKSHEET, WSBOOL, XCT, XF, XLS_MAX_COLS, YMULT| Constructor and Description |
|---|
MSODrawing() |
| Modifier and Type | Method and Description |
|---|---|
void |
addHeader()
add the set of subrecords necessary to define a Mso header record
used when removing images, charts, etc. |
int |
borderLineWidth()
if has a border, return the border line width
|
void |
close()
clear out object references in prep for closing workbook
|
void |
createCommentBox(int row,
int col)
create the sub-records necessary to define a Comment (Note) Box
|
void |
createDropDownListStyle(int col)
create records sub-records necessary to define an AutoFilter drop-down symbol
|
byte[] |
createRecord(int spid,
String imageName,
String shapeName,
int imageIndex)
create a new msodrawing record with the desired SPID, imageName, shapeName and imageIndex
bounds should also be set?
create correct record bytes
|
String |
debugOutput()
test debug output - FOR INTERNAL USE ONLY
|
short[] |
getBounds()
returns the bounds of this object
bounds are relative and based upon rows, columns and offsets within
|
int |
getCol() |
int |
getCol1() |
short[] |
getColAndOffset() |
short |
getColOffset()
returns the offset within the column in pixels
|
short[] |
getCoords()
return coordinates as {X, Y, W, H} in pixels
|
int |
getDrawingId()
return the ordinal # for this record
|
short |
getHeight()
public method that returns saved height value;
used when calculated method is incorrect due to row height changes ...
|
int |
getImageIndex() |
int |
getlastSPID()
return the lastSPID (only valid for the header msodrawing record
necessary to track so that newly added images have the appropriate SPID
|
Phonetic |
getMystery() |
String |
getName() |
int |
getNumShapes() |
MsofbtOPT |
getOPTRec()
retrieve the OPT rec for specific option setting
|
short |
getOriginalWidth()
public methd that returns saved width value;
useful when calculated method is incorrect due to column width changes ...
|
protected static XLSRecord |
getPrototype() |
int |
getRow0() |
int |
getRow1() |
short[] |
getRowAndOffset() |
String |
getShapeName() |
int |
getShapeType() |
int |
getSOLVERContainerLength()
returns the solver container length for this drawing record
used when setting the total size for the header drawing record
|
int |
getSPContainerLength()
returns the Shape Container Length for this drawing record
used when setting total size for the header drawing record
|
int |
getSPID()
return the SPID for this drawing record
|
protected static XLSRecord |
getTextBoxPrototype()
creates a msofbtClientTextbox, a very strange mso record containing only one sub-record or atom;
associated data=the text in the textbox, in a host-defined format i.e.
|
short |
getWidth()
calculate width based upon col#'s, coloffsets and col widths
units are in excel column units
|
short |
getX()
get X value of upper left corner
units are in excel units
|
short |
getY()
return the y position of this object in points
|
boolean |
hasBorder() |
void |
init()
parse the data contained in this drawing record
|
boolean |
isActive()
returns true if this drawing is active i.e.
|
boolean |
isHeader() |
void |
makeNonHeader()
removes the header-specific portion of this Msodrawing record, if any
useful when adding Msodrawng recs from other sources such as adding charts
only one Msodrawing header record is allowed
|
void |
removeHeader()
remove the set of subrecords necessary to define a MSO header record
used when removing images, charts, etc. |
void |
setBounds(short[] b) |
void |
setBoundsInPixels(short[] coords)
set coordinates as {X, Y, W, H} in 7
|
void |
setColAndOffset(short[] b) |
void |
setCoords(short[] coords)
set coordinates as {X, Y, W, H} in pixels
|
void |
setDrawingId(int id)
set the ordinal # for this drawing record
|
void |
setHeight(int h)
set the height of this object
units are in points
|
void |
setImageIndex(int value) |
void |
setImageName(String name) |
void |
setIsHeader()
set whether "this is the header drawing object for the sheet"
|
void |
setLastSPID(int spid)
set the LastSPID for this drawing record, if it's a header-type record
|
void |
setMystery(Phonetic p) |
void |
setNumShapes(int n)
set the number of shapes for this drawing rec
|
void |
setOPTSubRecord(int propertyId,
boolean isBid,
boolean isComplex,
int dtx,
byte[] complexBytes)
sets a specific OPT subrecord
|
void |
setRow(int row) |
void |
setRow1(int row) |
void |
setRowAndOffset(short[] b) |
void |
setShapeName(String name)
allow setting of "Named Range" name
|
void |
setShapeType(int shapeType) |
void |
setSheet(Sheet bs)
20081106 KSC: when set sheet, record original height and width
as dependent upon row heights ...
|
void |
setSPID(int spid)
set the SPID for this drawing record
used upon copyworksheet ...
|
void |
setWidth(int w)
set the width of this object
units are in excel units
|
void |
setX(int x)
set the x position of this object
units are in excel units
|
void |
setY(int y)
set the y position of this object
units are in points
|
String |
toString()
update the header records with new container lengths
|
void |
updateHeader(int otherSPContainers,
int otherContainers,
int numShapes,
int lastSPID)
update the header records with new container lengths
|
void |
updateImageIndex(int idx)
update just the image index portion of this record
useful when you don't need to rebuild entire record (and thus possibly lose information)
|
void |
updateRecord()
rebuild record bytes for this Msodrawing
aside from updating significant atoms such as MSOFBTOPT, it also recalculates container lengths
|
void |
updateRecord(int spid,
String imageName,
String shapeName,
int imageIndex,
short[] bounds)
update the existing mso with the appropriate basic mso data
NOTE: To set other mso data, see setShapeType, setIsHeader ... |
addContinue, clone, copyFormat, getBooleanVal, getByteAt, getByteReader, getBytes, getBytesAt, getCellAddress, getCellAddressWithSheet, getCellType, getColNumber, getColorTable, getContinueVect, getData, getDataType, getDblVal, getDefaultVal, getEncryptedByteReader, getFirstBlock, getFloatVal, getFont, getFormatPattern, getFormulaRec, getHyperlink, getInternalVal, getIntLocation, getIntVal, getIxfe, getLastBlock, getLength, getMergeRange, getOffset, getOpcode, getRealRecordIndex, getRecDesc, getRecordIndex, getRow, getRowNumber, getSheet, getStreamer, getStringVal, getStringVal, getWorkBook, getXfRec, hasContinues, initRowCol, isFormula, isNumber, isReadOnly, isValueForCell, mergeContinues, postStream, preStream, remove, removeContinues, resetCacheBytes, setBooleanVal, setByteReader, setCol, setData, setDebugLevel, setDoubleVal, setEncryptedByteReader, setFirstBlock, setFloatVal, setHyperlink, setIndex, setIntVal, setIsValueForCell, setIxfe, setLastBlock, setLength, setMergeRange, setOffset, setOpcode, setRow, setRowCol, setRowNumber, setStreamer, setStringVal, setValueForCell, setWorkBook, setXFRecord, setXFRecord, shouldEncrypt, toHexDumppublic byte[] PROTOTYPE_BYTES
public static final int COL
public static final int COLOFFSET
public static final int ROW
public static final int ROWOFFSET
public static final int COL1
public static final int COLOFFSET1
public static final int ROW1
public static final int ROWOFFSET1
public static final int OFFSETMAX
public static final double XCONVERSION
public static final double WCONVERSION
public static final double PIXELCONVERSION
public byte[] createRecord(int spid,
String imageName,
String shapeName,
int imageIndex)
spid - imageName - shapeName - imageIndex - public void init()
public void updateRecord(int spid,
String imageName,
String shapeName,
int imageIndex,
short[] bounds)
spid - Unique Shape IdimageName - String image name or nullshapeName - String shape name or nullimageIndex - int index into the image byte store (for a picture-type) or -1 for nullbounds - short[8] the position of this Mso given in rows, cols and offsetspublic void updateRecord()
spid - public void addHeader()
public void removeHeader()
public void updateHeader(int otherSPContainers,
int otherContainers,
int numShapes,
int lastSPID)
otherlength - public void updateImageIndex(int idx)
idx - public void makeNonHeader()
public void setIsHeader()
b - public MsofbtOPT getOPTRec()
public boolean isHeader()
public String getName()
public String getShapeName()
public boolean hasBorder()
public int borderLineWidth()
public void setImageIndex(int value)
public void setImageName(String name)
public void setDrawingId(int id)
id - public int getDrawingId()
public void setShapeName(String name)
name - public int getImageIndex()
public void setBounds(short[] b)
public void setBoundsInPixels(short[] coords)
coords - public short[] getCoords()
coords - public void setCoords(short[] coords)
coords - public short[] getBounds()
public int getCol()
public int getCol1()
public int getRow0()
public int getRow1()
public void setRow(int row)
public void setRow1(int row)
public short getX()
public short getColOffset()
public void setX(int x)
x - public short getY()
public void setY(int y)
y - public short getOriginalWidth()
public short getWidth()
public short getHeight()
public void setWidth(int w)
w - public void setHeight(int h)
h - public short[] getColAndOffset()
public void setColAndOffset(short[] b)
public short[] getRowAndOffset()
public void setRowAndOffset(short[] b)
public Phonetic getMystery()
public void setMystery(Phonetic p)
phonetic - public int getNumShapes()
public void setNumShapes(int n)
n - public int getlastSPID()
public int getSPContainerLength()
public int getSOLVERContainerLength()
protected static XLSRecord getPrototype()
protected static XLSRecord getTextBoxPrototype()
public void setOPTSubRecord(int propertyId,
boolean isBid,
boolean isComplex,
int dtx,
byte[] complexBytes)
propertyId - int property id see MsoconstantsisBid - true if this is a BLIP idisComplex - true if has complexBytesdtx - if not isComplex, the value; if isComplex, lengthcomplexBytes - complex bytes if isComplexpublic void setLastSPID(int spid)
spid - public void setSPID(int spid)
spid - public int getSPID()
public void setShapeType(int shapeType)
public int getShapeType()
public String toString()
public void setSheet(Sheet bs)
public boolean isActive()
public void createDropDownListStyle(int col)
public void createCommentBox(int row,
int col)
public String debugOutput()
Copyright © 2002–2019 Starter Inc.. All rights reserved.