public void SetCellStyle(string cell, object style) { if (read_only) { throw new Exception("Excel file is opened in read only mode and can't be modified!"); } var p = sheet_data.IndexOf("r=\"" + cell + "\""); var p2 = sheet_data.IndexOf("s=\"", p).Add(3); var p3 = sheet_data.IndexOf("\"", p2 + 1); var p4 = sheet_data.IndexOf(">", p); if (p4 < p2) { } else { sheet_data = sheet_data.Remove(p2, p3 - p2); sheet_data = sheet_data.Insert(p2, style + ""); } }