public void Init(CreateAndRegisterStream createAndRegisterStream, AutoFit autoFit, string reportName) { this.m_outStream = createAndRegisterStream(reportName, "doc", null, "application/msword", false, StreamOper.CreateAndRegister); this.m_tableStream = createAndRegisterStream("TableStream", null, null, null, true, StreamOper.CreateOnly); this.m_mainStream = createAndRegisterStream("WordDocument", null, null, null, true, StreamOper.CreateOnly); this.m_fontTable = createAndRegisterStream("FontTable", null, null, null, true, StreamOper.CreateOnly); this.m_dataStream = createAndRegisterStream("Data", null, null, null, true, StreamOper.CreateOnly); this.m_listStream = createAndRegisterStream("List", null, null, null, true, StreamOper.CreateOnly); this.m_listLevelStream = createAndRegisterStream("ListLevel", null, null, null, true, StreamOper.CreateOnly); Stream textPiece = createAndRegisterStream("TextPiece", null, null, null, true, StreamOper.CreateOnly); Stream chpTable = createAndRegisterStream("ChpTable", null, null, null, true, StreamOper.CreateOnly); Stream papTable = createAndRegisterStream("PapTable", null, null, null, true, StreamOper.CreateOnly); this.m_charFormat = new CharacterFormat(chpTable, this.m_fcStart); this.m_parFormat = new ParagraphFormat(papTable, this.m_fcStart); this.m_wordText = new WordText(textPiece); this.m_secFormat = new SectionFormat(); this.m_currentRow = new TableData(1, true); this.m_tapStack = new Stack <TableData>(); this.m_fontNameSet = new Dictionary <string, int>(); this.WriteFont("Times New Roman"); this.WriteFont("Symbol"); this.WriteFont("Arial"); this.m_imgIndex = 0; this.m_fldsMain = new FieldsTable(); this.m_fldsHdr = new FieldsTable(); this.m_fldsCurrent = this.m_fldsMain; this.m_bookmarks = new Bookmarks(); this.m_images = new Dictionary <ImageHash, int>(); this.m_autoFit = autoFit; }
public void WriteText(string text) { if (text != null) { int num = 0; char[] chars = WordText.EscapeText(text, out num); byte[] bytes = Encoding.Unicode.GetBytes(chars, 0, num); this.m_textPiece.Write(bytes, 0, bytes.Length); this.m_currentCp += num; } }