Patch level :10.0 954 in avanti
Files correlati : Ricompilazione Demo : [ ] Commento : aggiunto metodo build_trc per raccattare il tracciato record di un csv recordset salvato in fmt_html se il recordset non ha delle column già esplicitamente definite (prima applicazione ve3800) git-svn-id: svn://10.65.10.50/branches/R_10_00@21780 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
ea36c4b0a6
commit
6bcba93538
@ -153,7 +153,8 @@ bool TRecordset::save_as_html(const char* path)
|
|||||||
str << tok;
|
str << tok;
|
||||||
}
|
}
|
||||||
if (get_attr(c, attr, true))
|
if (get_attr(c, attr, true))
|
||||||
out << " <th style=\"color : #" << format("%06x", attr.get_foreground() & 0xFFFFFF) << "; background-color : #" << format("%06x", attr.get_background() & 0xFFFFFF) << "\">" ;
|
out << " <th style=\"color : #" << format("%06x", attr.get_foreground() & 0xFFFFFF)
|
||||||
|
<< "; background-color : #" << format("%06x", attr.get_background() & 0xFFFFFF) << "\">" ;
|
||||||
else
|
else
|
||||||
out << " <th>";
|
out << " <th>";
|
||||||
|
|
||||||
@ -176,7 +177,8 @@ bool TRecordset::save_as_html(const char* path)
|
|||||||
const TRecordset_column_info& ci = column_info(c);
|
const TRecordset_column_info& ci = column_info(c);
|
||||||
|
|
||||||
if (get_attr(c, attr))
|
if (get_attr(c, attr))
|
||||||
out << " <td style=\"color : #" << format("%06x", attr.get_foreground() & 0xFFFFFF) << "; background-color : #" << format("%06x", attr.get_background() & 0xFFFFFF) << "\">" ;
|
out << " <td style=\"color : #" << format("%06x", attr.get_foreground() & 0xFFFFFF)
|
||||||
|
<< "; background-color : #" << format("%06x", attr.get_background() & 0xFFFFFF) << "\">" ;
|
||||||
else
|
else
|
||||||
out << " <td>";
|
out << " <td>";
|
||||||
switch (ci._type)
|
switch (ci._type)
|
||||||
@ -184,12 +186,13 @@ bool TRecordset::save_as_html(const char* path)
|
|||||||
case _intfld:
|
case _intfld:
|
||||||
case _longfld:
|
case _longfld:
|
||||||
{
|
{
|
||||||
const long r = get(c).as_int();
|
const TVariant& var = get(c);
|
||||||
|
const long r = var.as_int();
|
||||||
val.cut(0);
|
val.cut(0);
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
val << r;
|
val << r;
|
||||||
else
|
else
|
||||||
get(c).as_string(val);
|
var.as_string(val);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case _realfld:
|
case _realfld:
|
||||||
|
@ -252,8 +252,10 @@ unsigned int TCSV_recordset::columns() const
|
|||||||
unsigned int c = _trc.items();
|
unsigned int c = _trc.items();
|
||||||
if (c == 0)
|
if (c == 0)
|
||||||
{
|
{
|
||||||
const TRecnotype i = items();
|
const TRecnotype i = items(); //rilegge fai di testo e tenta di crearne il tracciato _trc
|
||||||
c = _trc.items();
|
c = _trc.items();
|
||||||
|
if (c == 0 && i > 0)
|
||||||
|
c = ((TCSV_recordset*)this)->build_trc();
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
@ -286,12 +288,9 @@ void TCSV_recordset::create_column(const char * name, TFieldtypes type)
|
|||||||
_trc.add(info);
|
_trc.add(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TCSV_recordset::load_file(const TFilename& n)
|
unsigned int TCSV_recordset::build_trc()
|
||||||
{
|
{
|
||||||
if (!TText_recordset::load_file(n))
|
_trc.destroy();
|
||||||
return false;
|
|
||||||
|
|
||||||
_trc.destroy();
|
|
||||||
int cols = 1;
|
int cols = 1;
|
||||||
int i;
|
int i;
|
||||||
for (i = items()-1; i >= 0; i--)
|
for (i = items()-1; i >= 0; i--)
|
||||||
@ -336,7 +335,16 @@ bool TCSV_recordset::load_file(const TFilename& n)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return _trc.items();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool TCSV_recordset::load_file(const TFilename& n)
|
||||||
|
{
|
||||||
|
if (!TText_recordset::load_file(n))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return build_trc() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TCSV_recordset::set(unsigned int column, const TVariant& var)
|
bool TCSV_recordset::set(unsigned int column, const TVariant& var)
|
||||||
|
@ -71,6 +71,7 @@ protected:
|
|||||||
char separator() const { return _separator; }
|
char separator() const { return _separator; }
|
||||||
void set_separator(const char s) { CHECK(s != 0, "Invalid separator"); _separator = s; }
|
void set_separator(const char s) { CHECK(s != 0, "Invalid separator"); _separator = s; }
|
||||||
virtual TQuery_type parse_query(const char* query, TFilename& table);
|
virtual TQuery_type parse_query(const char* query, TFilename& table);
|
||||||
|
unsigned int build_trc();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual unsigned int columns() const;
|
virtual unsigned int columns() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user