Patch level :10.0 196

Files correlati     : tutti
Ricompilazione Demo : [ ]
Commento            :
0001045: Aprire excel esportato nei seguenti programmi (vale come regola)
asto dx esporta in excel deve aprire l'anteprima nei programmi che hanno un monitor (già succede per le ricerche tabelle) e non aprire la finestra di salvataggio)
I programmi per ora (ma per il futuro vale come regola) incriminati sono:
Eleco articoli in contratto
Passaggi per contratto
Visualizzazione e modifica giri
Pagina 7 documenti di trasporto


git-svn-id: svn://10.65.10.50/trunk@17927 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2008-12-17 11:42:23 +00:00
parent fd12442304
commit 883b0df1a1
4 changed files with 64 additions and 36 deletions

@ -3414,47 +3414,53 @@ void TSheet_field::set_userput(SHEET_USERGETPUT handler)
bool TSheet_field::esporta() const
{
TFilename name("tabella.xls");
FILE_SPEC fs;
xvt_fsys_convert_str_to_fspec(name, &fs);
if (xvt_dm_post_file_save(&fs, TR("Selezionare il file di destinazione")))
xvt_fsys_convert_fspec_to_str(&fs, name.get_buffer(), name.size());
TFilename name;
name.tempdir();
name.add(mask().source_file().name_only());
name.ext("xls");
ofstream xls(name);
const char sep = '\t';
TToken_string tab(128, sep);
if (name.full())
TString str;
int columns = 0;
for (columns = 0; ; columns++)
{
ofstream xls(name);
const char sep = '\t';
TToken_string tab(128, sep);
str = get_column_header(columns);
if (str.not_empty())
tab.add(str);
else
break;
}
xls << tab << endl;
TString str;
int columns = 0;
for (columns = 0; ; columns++)
for (long n = 0; n < items(); n++)
{
const TToken_string& r = ((TSheet_field*)this)->row(n);
tab = r;
tab.replace(r.separator(), sep);
tab.separator(sep);
for (int c = 0; tab.get(c, str); c++)
{
str = get_column_header(columns);
if (str.not_empty())
tab.add(str);
else
break;
if (real::is_real(str))
{
if (real::is_null(str))
str.cut(0);
else
{
if (real::is_natural(str))
str.trim();
else
xvt_str_number_format(str.get_buffer(), str.size());
}
tab.add(str, c);
}
}
xls << tab << endl;
for (long n = 0; n < items(); n++)
{
const TToken_string& r = ((TSheet_field*)this)->row(n);
tab = r;
tab.replace(r.separator(), sep);
tab.separator(sep);
for (int c = 0; tab.get(c, str); c++)
{
if (real::is_real(str))
{
xvt_str_number_format(str.get_buffer(), str.size());
tab.add(str, c);
}
}
xls << tab << endl;
}
}
xls.close();
xvt_sys_goto_url(name, "open");
return true;
}

@ -799,8 +799,8 @@ static const TString& bytes2str(long b)
TString& tmp = get_tmp_string(50);
if (b > 0)
{
const long mega = 1024*1024;
if (b >= 2*mega)
const double mega = 1024*1024;
if (b >= mega)
tmp.format("%.2lf MBytes", double(b)/mega);
else
{

@ -1291,6 +1291,8 @@ public:
int add_item(short icon, const char* text, int flags);
bool select(int item, bool on);
int selected() const;
int items() const;
void clear();
TOutlook_window(int x, int y, int dx, int dy, WINDOW parent, TOutlook_field* owner);
};
@ -1320,6 +1322,12 @@ bool TOutlook_window::select(int item, bool on)
int TOutlook_window::selected() const
{ return xvt_list_get_sel_index(_ctrl); }
int TOutlook_window::items() const
{ return xvt_list_count(_ctrl); }
void TOutlook_window::clear()
{ xvt_list_clear(_ctrl); }
TOutlook_window::TOutlook_window(int x, int y, int dx, int dy, WINDOW parent, TOutlook_field* owner)
: TControl_host_window(x, y, dx, dy, parent, owner)
{
@ -1351,6 +1359,18 @@ TField_window* TOutlook_field::create_window(int x, int y, int dx, int dy, WINDO
void TOutlook_field::create(short dlg, int x, int y, int dx, int dy, WINDOW parent)
{ construct(dlg, "", x, y, dy, parent, "", dx); }
void TOutlook_field::clear()
{
TOutlook_window& ow = (TOutlook_window&)win();
ow.clear();
}
int TOutlook_field::items() const
{
TOutlook_window& ow = (TOutlook_window&)win();
return ow.items();
}
int TOutlook_field::add_item(short icon, const char* text, int flags)
{
TOutlook_window& ow = (TOutlook_window&)win();

@ -83,7 +83,9 @@ protected: // TWindowed_field
public:
int add_item(short icon, const char* text, int flags);
void create(short dlg, int x, int y, int dx, int dy, WINDOW parent);
void clear();
int items() const;
virtual void set(const char* data);
virtual const TString& get() const;