1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41:
| if (File.Exists(strTemplateFile)) { using (StreamReader sr = new StreamReader(strTemplateFile, System.Text.Encoding.Default)) { String line = sr.ReadToEnd();
foreach (KeyValuePair<string, string> data in strDescription) { string strKey = string.Format("[${0}$]", data.Key); strKey = strKey.ToUpper();
if (line.Contains(strKey)) { strData = data.Value.Replace("$r$", "\r\n"); line = line.Replace(strKey, strData); } else { if (strError != "") strError += CAN_DocGenerator.Global.kCRNL1; strError += data.Key; iReturn = 3; } }
File.Create(strTempFile).Close(); File.WriteAllText(strTempFile, line, System.Text.Encoding.Default);
if (strDestExt == "pdf") { string pdf = ""; pdfTool.CreatePDFfromRTFviaSautin(strTempFile, ref pdf, ref strLogMsg, errorReport); File.Delete(strTempFile); } }
GC.Collect(); return iReturn; } |