The STSHI structure has the following format:
// STSHI: STyleSHeet Information, as stored in a file
// Note that new fields can be added to the STSHI without invalidating
// the file format, because it is stored preceded by it's length.
// When reading a STSHI from an older version, new fields will be zero.
typedef struct _STSHI
{
ushort cstd; // Count of styles in stylesheet
ushort cbSTDBaseInFile; // Length of STD Base as stored in a file
BF fStdStylenamesWritten : 1; // Are built-in stylenames stored?
BF : 15; // Spare flags
ushort stiMaxWhenSaved; // Max sti known when this file was written
ushort istdMaxFixedWhenSaved; // How many fixed-index istds are there?
ushort nVerBuiltInNamesWhenSaved; // Current version of built-in stylenames
FTC rgftcStandardChpStsh[3]; // ftc used by StandardChpStsh for this document
} STSHI;
The cb preceding the STSHI in the file is the length of the STSHI as stored in the file. The current definition of the STSHI structure might be longer or shorter than that stored in the file, the stylesheet reader routine needs to take this into account.
stshi.cstd: The number of styles in this stylesheet. There will be stshi.cstd (cbSTD, STD) pairs in the file following the STSHI. Note that styles can be empty, i.e. cbSTD == 0.
stshi.cbSTDBaseInFile: The STD structure (see below) is divided into a fixed-length "base", and a variable length part. The stshi.cbSTDBaseInFile indicates the size in bytes of the fixed-length base of the STD as it was written in this file. If the STD base is grown in a future version, the file format doesn't change, because the stylesheet reader can discard parts it doesn't know about, or use defaults if the file's STD is not as large as it was expecting. (Currently, stshi.cbSTDBaseInFile is 8.)
stshi.fStdStylenamesWritten: Previous versions of Word did not store the style name if the style was a built-in style; Word 6.0 does, for compatibility with future versions. Note that the built-in stylenames may need to be "regenerated" if the file is opened in a different language or if stshi.nVerBuiltInNamesWhenSaved doesn't match the expected value.
stshi.stiMaxWhenSaved: This indicates the last built-in style known to the version of Word that saved this file.
stshi.istdMaxFixedWhenSaved: Each array of styles has some fixed-index styles at the beginning. This indicates the number of fixed-index positions reserved in the stylesheet when it was saved.
stshi.nVerBuiltInNamesWhenSaved: Since built-in stylenames are saved with the document, this provides an way to see if the saved names are the same "version" as the names in the version of Word that is loading the file. If not, the built-in stylenames need to be "regenerated", i.e. the old names need to be replaced with the new.
stshi.rgftcStandardChpStsh: This is the default fonts for this stylesheet. The first is for Asci characters (0-127), the second is for Far East characters, and the third is the default font for non-Far East, non-Asci text. See notes on sprmCRgftcX for details.