public void WriteTo(HWPFFileSystem sys, int fcMin) { HWPFStream docStream = sys.GetStream("WordDocument"); HWPFStream tableStream = sys.GetStream("1Table"); int offset = docStream.Offset; int len = _sections.Count; PlexOfCps plex = new PlexOfCps(SED_SIZE); for (int x = 0; x < len; x++) { SEPX sepx = _sections[x]; byte[] grpprl = sepx.GetGrpprl(); // write the sepx to the document stream. starts with a 2 byte size // followed by the grpprl byte[] shortBuf = new byte[2]; LittleEndian.PutShort(shortBuf, (short)grpprl.Length); docStream.Write(shortBuf); docStream.Write(grpprl); // set the fc in the section descriptor SectionDescriptor sed = sepx.GetSectionDescriptor(); sed.SetFc(offset); // add the section descriptor bytes to the PlexOfCps. // original line - //GenericPropertyNode property = new GenericPropertyNode(sepx.Start, sepx.End, sed.ToArray()); // Line using Ryan's FCtoCP() conversion method - // unable to observe any effect on our testcases when using this code - piers GenericPropertyNode property = new GenericPropertyNode(tpt.GetCharIndex(sepx.StartBytes), tpt.GetCharIndex(sepx.EndBytes), sed.ToArray()); plex.AddProperty(property); offset = docStream.Offset; } tableStream.Write(plex.ToByteArray()); }