";
this.dt = null;
this.col_list = null;
this.field_name_list = null;
this.get_field_list = function ()
{
var dt = this.dt;
var col_list = new Array();
var _field_list = new Array();
var str_template = this.str_template;
for (var col = 0; col < dt.getFieldCount(); col++)
{
var field_name = dt.getFieldName(col);
var target_name = "%" + field_name + "%";
if (str_template.indexOf(target_name) != -1
|| str_template.indexOf("%" + field_name + "_Source%") != -1
)
{
_field_list.push(field_name);
col_list.push(col);
}
}
this.field_name_list = _field_list;
this.col_list = col_list;
}
this.GetDataGrid = function ()
{
var i, strnum, j, rowCounter;
var dt = this.dt;
var strBuf = new StringBuilder();
var row, start, buf, strField, p_row;
var dt_row = 0, dt_col = 0;
var start_row = 0, end_row = 0;
var DataGrid = null;
var col_list = this.col_list;
var field_name_list = this.field_name_list;
var iGuid_row = 0;
j = 0;
rowCounter = 1;
start_row = 0;
end_row = dt.MaxRow();
DataGrid = this.str_template.split(this.str_split);
row = DataGrid.length - 3;
strBuf.Append("\n" + DataGrid[0]);
start = 2;
buf = DataGrid[1];
strBuf.Append("\n" + buf);
for (dt_row = start_row; dt_row < end_row; dt_row++)
{
buf = "";
p_row = j % row;
buf = DataGrid[start + p_row];
// @@XX@@ 巨集之處理, COLSPAN
// @@XX@@YY@@ --> XX : 用那個 buffer, YY : Colspan 數字
var marco_no = this.check_template_marco_no(buf);
var colspan_no = this.check_template_colspan(buf);
var colspan = "";
if (marco_no != -1)
{
if (colspan_no != -1)
{
colspan = "COLSPAN=" + colspan_no;
buf = buf.ReplaceAll("@@" + marco_no + "@@" + colspan_no + "@@", DataGrid[marco_no]);
}
else
buf = buf.ReplaceAll("@@" + marco_no + "@@", DataGrid[marco_no]);
}
// -------------------------------
if (buf.indexOf("%row%") != -1)
buf = buf.ReplaceAll("%row%", dt_row+1);
buf = buf.ReplaceAll("%COLSPAN%", colspan);
for (dt_col = 0; dt_col < col_list.length; dt_col++)
{
var FieldName = field_name_list[dt_col];
var _col = col_list[dt_col];
var _value = this.dt.getRowValueByCol(dt_row, _col);;
if (this.flg_show_html == 0) {
try {
_value = _value.ReplaceAll("&", "&");
_value = _value.ReplaceAll("<", "<");
_value = _value.ReplaceAll(">", ">");
_value = _value.ReplaceAll("\"", """);
}
catch (e) {}
}
if (this.flg_auto_breakline == 1) {
try {
_value = _value.ReplaceAll("\n", "
");
}
catch (e) {}
}
if (buf.indexOf("%" + FieldName + "_Source%") != -1) {
buf = buf.ReplaceAll("%" + FieldName + "_Source%", _value.Left(600).ReplaceAll("
", "\n"));
}
if (this.max_cols != -1 && _value.length > this.max_cols) {
_value = _value.Left(this.max_cols) + " ...";
}
// iGuid don't display
if (_value == "iGuid" && FieldName == "NAME")
{
iGuid_row = 1;
buf = buf.ReplaceAll("