Patch level : 10.0
Files correlati : ve0.exe Ricompilazione Demo : [ ] Commento : 0001300: Esportazione Exel Su tutti i documenti l'esportazione in exel crea il file senza mettere l'intestazione delle colonne git-svn-id: svn://10.65.10.50/trunk@18908 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
4f15ade556
commit
f5448cd9e1
@ -3504,6 +3504,19 @@ void TSheet_field::set_userput(SHEET_USERGETPUT handler)
|
|||||||
_userput = handler;
|
_userput = handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static TString& clean_white_space(TString& str)
|
||||||
|
{
|
||||||
|
str.trim();
|
||||||
|
char* buff = str.get_buffer();
|
||||||
|
for (char* b = buff; *b; b++)
|
||||||
|
{
|
||||||
|
if (*b > '\0' && *b < ' ')
|
||||||
|
*b = ' ';
|
||||||
|
}
|
||||||
|
str.strip_double_spaces();
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
bool TSheet_field::esporta() const
|
bool TSheet_field::esporta() const
|
||||||
{
|
{
|
||||||
TFilename name;
|
TFilename name;
|
||||||
@ -3514,27 +3527,28 @@ bool TSheet_field::esporta() const
|
|||||||
ofstream xls(name);
|
ofstream xls(name);
|
||||||
const char sep = '\t';
|
const char sep = '\t';
|
||||||
TToken_string tab(128, sep);
|
TToken_string tab(128, sep);
|
||||||
|
|
||||||
TString str;
|
TString str;
|
||||||
|
|
||||||
int columns = 0;
|
int columns = 0;
|
||||||
for (columns = 0; ; columns++)
|
XI_OBJ** pcols = xi_get_member_list(_ctl->xi_object(), &columns);
|
||||||
|
|
||||||
|
for (int c = 1; c < columns; c++)
|
||||||
{
|
{
|
||||||
str = get_column_header(columns);
|
xi_get_text(pcols[c], str.get_buffer(), str.size());
|
||||||
if (str.not_empty())
|
tab.add(clean_white_space(str));
|
||||||
tab.add(str);
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xls << tab << endl;
|
xls << tab << endl;
|
||||||
|
|
||||||
for (long n = 0; n < items(); n++)
|
for (long n = 0; n < items(); n++)
|
||||||
{
|
{
|
||||||
const TToken_string& r = ((TSheet_field*)this)->row(n);
|
const TToken_string& r = ((TSheet_field*)this)->row(n);
|
||||||
tab = r;
|
tab.cut(0);
|
||||||
tab.replace(r.separator(), sep);
|
for (int c = 1; c < columns; c++)
|
||||||
tab.separator(sep);
|
|
||||||
for (int c = 0; tab.get(c, str); c++)
|
|
||||||
{
|
{
|
||||||
|
const int idx = cid2index(pcols[c]->cid);
|
||||||
|
r.get(idx, str);
|
||||||
|
clean_white_space(str);
|
||||||
if (real::is_real(str))
|
if (real::is_real(str))
|
||||||
{
|
{
|
||||||
if (real::is_null(str))
|
if (real::is_null(str))
|
||||||
@ -3546,8 +3560,9 @@ bool TSheet_field::esporta() const
|
|||||||
else
|
else
|
||||||
xvt_str_number_format(str.get_buffer(), str.size());
|
xvt_str_number_format(str.get_buffer(), str.size());
|
||||||
}
|
}
|
||||||
tab.add(str, c);
|
|
||||||
}
|
}
|
||||||
|
if (str.not_empty())
|
||||||
|
tab.add(str, c-1);
|
||||||
}
|
}
|
||||||
xls << tab << endl;
|
xls << tab << endl;
|
||||||
}
|
}
|
||||||
|
@ -1337,6 +1337,19 @@ bool TSheet::tutti_handler(TMask_field& f, KEY k)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static TString& clean_white_space(TString& str)
|
||||||
|
{
|
||||||
|
str.trim();
|
||||||
|
char* buff = str.get_buffer();
|
||||||
|
for (char* b = buff; *b; b++)
|
||||||
|
{
|
||||||
|
if (*b > '\0' && *b < ' ')
|
||||||
|
*b = ' ';
|
||||||
|
}
|
||||||
|
str.strip_double_spaces();
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
bool TSheet::export_handler(TMask_field& f, KEY k)
|
bool TSheet::export_handler(TMask_field& f, KEY k)
|
||||||
{
|
{
|
||||||
if (k == K_SPACE)
|
if (k == K_SPACE)
|
||||||
@ -1367,42 +1380,32 @@ bool TSheet::export_handler(TMask_field& f, KEY k)
|
|||||||
const char sep = '\t';
|
const char sep = '\t';
|
||||||
TToken_string tab(128, sep);
|
TToken_string tab(128, sep);
|
||||||
|
|
||||||
TString80 str;
|
TString str;
|
||||||
|
|
||||||
int columns = 0;
|
int columns = 0;
|
||||||
for (columns = 0; ; columns++)
|
XI_OBJ** pcols = xi_get_member_list(s._sheet->xi_object(), &columns);
|
||||||
|
for (int c = 1; c < columns; c++)
|
||||||
{
|
{
|
||||||
if (s._sheet->head(columns, str))
|
xi_get_text(pcols[c], str.get_buffer(), str.size());
|
||||||
{
|
tab.add(clean_white_space(str));
|
||||||
if (str.replace('\n', ' ') > 0)
|
|
||||||
str.strip_double_spaces();
|
|
||||||
tab.add(str);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
xls << tab << endl;
|
xls << tab << endl;
|
||||||
|
|
||||||
for (long i = 0; i < s.items(); i++)
|
for (long i = 0; i < s.items(); i++)
|
||||||
{
|
{
|
||||||
tab = s.row(i);
|
const TToken_string& r = s.row(i);
|
||||||
tab.replace('|', sep);
|
tab.cut(0);
|
||||||
tab.separator(sep);
|
for (int c = 1; c < columns; c++)
|
||||||
for (int c = 0; c < columns; c++)
|
|
||||||
{
|
{
|
||||||
const char ct = s._sheet->column_type(c);
|
const int idx = pcols[c]->cid - 1101;
|
||||||
|
r.get(idx, str);
|
||||||
|
clean_white_space(str);
|
||||||
|
if (str.not_empty())
|
||||||
|
{
|
||||||
|
const char ct = s._sheet->column_type(idx);
|
||||||
if (ct == 'P' || ct == 'V')
|
if (ct == 'P' || ct == 'V')
|
||||||
{
|
|
||||||
tab.get(c, str);
|
|
||||||
if (str.full())
|
|
||||||
{
|
|
||||||
if (real::is_natural(str))
|
|
||||||
str.trim();
|
|
||||||
else
|
|
||||||
xvt_str_number_format(str.get_buffer(), str.size());
|
xvt_str_number_format(str.get_buffer(), str.size());
|
||||||
}
|
tab.add(str, c-1);
|
||||||
else
|
|
||||||
str.cut(0);
|
|
||||||
tab.add(str, c);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xls << tab << endl;
|
xls << tab << endl;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user