void setCell(int row, int col, string s, string rtfString, int headingInfo) { //Debug print "L \n" print "setCell, #col: " col "\n" closeIfNonNull objCell clear(args) put(args, (intToCol col) row (NLS_(""))) checkRes(oleGet(objSheet, cMethodRange, args, objCell)) if (null objCell) { ack getExtMsg("String_Unable_to_get_cell_object",NLSTEMP_("Unable to get cell object")) halt } // Excel considers a string starting with the following characters:- // An equal character (=), a plus character (+), a minus character (-) or the (@) character // to be the start of an excel formula, hence it throws an error "OLE method failed". // To avoid this we append "'" before the string. // Also, "numbers-numbers" or "numbers-numbers-numbers" (Eg: 14-3, 14-10-17) will be intrepreted as "Date" in Excel. // So we append "'" before those strings also. if( s[0:0] == (NLS_("=")) || s[0:0] == (NLS_("+")) || s[0:0] == (NLS_("-")) || s[0:0] == (NLS_("@")) || dateCheck s ) { s = (NLS_("'")) s } // first set the cell with plain text checkRes(olePut(objCell, cPropertyValue, s)) //In this line string in string s will be written in // now apply the RTF formatting in case the passed-in rtfString is non-NULL AND the user // has chosen to export the rich text formatting. if(rtfString != (NLS_("")) && preserveRichTextFormatting) { applyRTFFormattingToExportedText(rtfString, headingInfo) } //Debug print "LL \n" }