Migliorata esportazione Excel da TPrintapp

git-svn-id: svn://10.65.10.50/branches/R_10_00@23005 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2014-10-27 08:22:37 +00:00
parent a6899f1fb2
commit dc133a5ec1
10 changed files with 47 additions and 25 deletions

View File

@ -97,6 +97,7 @@
#define DOC_MODPAG "MODPAG" #define DOC_MODPAG "MODPAG"
#define DOC_CONTRATTO "CONTRATTO" #define DOC_CONTRATTO "CONTRATTO"
#define DOC_PAF "PAF" #define DOC_PAF "PAF"
#define DOC_MANDATO "MANDATO"
// Virtuali // Virtuali

View File

@ -12,7 +12,6 @@
#define EFF_CODVAL "CODVAL" #define EFF_CODVAL "CODVAL"
#define EFF_DATACAMBIO "DATACAMBIO" #define EFF_DATACAMBIO "DATACAMBIO"
#define EFF_CAMBIO "CAMBIO" #define EFF_CAMBIO "CAMBIO"
//#define EFF_CONTROEURO "CONTROEURO" 06/02/2012
#define EFF_CODABI "CODABI" #define EFF_CODABI "CODABI"
#define EFF_CODCAB "CODCAB" #define EFF_CODCAB "CODCAB"
#define EFF_IBAN "IBAN" #define EFF_IBAN "IBAN"
@ -40,5 +39,6 @@
#define EFF_CUP "CUP" #define EFF_CUP "CUP"
#define EFF_CIG "CIG" #define EFF_CIG "CIG"
#define EFF_CONTSEP "CONTSEP" #define EFF_CONTSEP "CONTSEP"
#define EFF_MANDATO "MANDATO"
#endif #endif

View File

@ -339,6 +339,8 @@ public:
// @cmember Ritorna il nome della variabile di posto varnum // @cmember Ritorna il nome della variabile di posto varnum
const char* varname(int varnum) const const char* varname(int varnum) const
{ return find(varnum)->getname(); } { return find(varnum)->getname(); }
bool exist(const char* name) const
{ return find(name) != NULL; }
// @cmember Setta l'oggetto TVararray con il nome e il valore della variabile // @cmember Setta l'oggetto TVararray con il nome e il valore della variabile
void set(const char* varname, const real& val); void set(const char* varname, const real& val);
@ -480,6 +482,9 @@ public:
// @cmember Ritorna l'array di variabili // @cmember Ritorna l'array di variabili
const TVararray& vars() const const TVararray& vars() const
{ return _var; } { return _var; }
// @cmember controlla l'esistenza di una variabile
bool exist(const char* name) const
{ return _var.exist(name); }
// @cmember Setta la variabile con nome e numero // @cmember Setta la variabile con nome e numero
void setvar(const char* varname, const real& val); void setvar(const char* varname, const real& val);
@ -507,8 +512,7 @@ public:
// @cmember Costruttore di copia // @cmember Costruttore di copia
TExpression(const TExpression & expr); TExpression(const TExpression & expr);
// @cmember Distruttore // @cmember Distruttore
virtual ~TExpression() virtual ~TExpression() {}
{}
}; };
bool is_real_discount(const TString& exp); bool is_real_discount(const TString& exp);

View File

@ -701,7 +701,7 @@ bool TFile_text::_autoload(TRecord_text& rec, TCursor& cur , TTracciato_record&
campo = field.read(rel); campo = field.read(rel);
const TString& message = tc.message(); const TString& message = tc.message();
if (!message.empty()) if (message.full())
{ {
TToken_string msg (message, ','); TToken_string msg (message, ',');
if (!msg.blank()) if (!msg.blank())

View File

@ -536,7 +536,9 @@ TForm_item& TForm_item::find_field(const TString& id) const
pos_id=freccia+2; pos_id=freccia+2;
id_num=atoi(id.mid(pos_id)); id_num=atoi(id.mid(pos_id));
se = id[0]; se = id[0];
} else { }
else
{
id_num=0; id_num=0;
se = section().section_type(); se = section().section_type();
pos_id=0; pos_id=0;
@ -545,7 +547,9 @@ TForm_item& TForm_item::find_field(const TString& id) const
{ {
TForm_item& des = form().find_field(se, pt, id_num); TForm_item& des = form().find_field(se, pt, id_num);
return des; return des;
} else { // id stringa : campo sezione }
else
{ // id stringa : campo sezione
TForm_item& des = form().find_field(se, pt, id.mid(pos_id)); TForm_item& des = form().find_field(se, pt, id.mid(pos_id));
return des; return des;
} }
@ -3707,10 +3711,8 @@ bool TForm::print(
if ((_char_to_pos != '\0' || ((_ipx +_ipy+_fpx) != 0)) && // Se i parametri di posizionamento sono settati e if ((_char_to_pos != '\0' || ((_ipx +_ipy+_fpx) != 0)) && // Se i parametri di posizionamento sono settati e
(_x != 0 || _y != 0)) // cosi' pure gli offset genera un errore. (_x != 0 || _y != 0)) // cosi' pure gli offset genera un errore.
{ return error_box(TR("Impossibile impostare contemporaneamente offset e posizionamento modulo."));
return error_box(TR("Non e' possibile settare contemporaneamente gli offset"
" e i parametri di posizionamento del modulo."));
}
TPrinter& pr = printer(); TPrinter& pr = printer();
if (_frompage) pr.set_from_page(_frompage); if (_frompage) pr.set_from_page(_frompage);
if (_topage) pr.set_to_page(_topage); if (_topage) pr.set_to_page(_topage);

View File

@ -38,7 +38,7 @@ bool goto_url(const char* url)
TConfig link(CONFIG_USER, "Link"); TConfig link(CONFIG_USER, "Link");
app = link.get(ext); app = link.get(ext);
if (app.not_empty()) if (app.full())
{ {
app << " \"" << url << '"'; app << " \"" << url << '"';
long error = xvt_sys_execute(app, false, false); //verificare long error = xvt_sys_execute(app, false, false); //verificare

View File

@ -1829,12 +1829,12 @@ bool TCursor::scan(CURSOR_SCAN_FUNC func, void* pJolly, const char* msg)
bool ok = true; bool ok = true;
if (tot > 0) if (tot > 0)
{ {
TProgind* pi = NULL; TProgress_monitor* pi = NULL;
if (tot > 1) if (tot > 1)
{ {
if (msg == NULL || *msg == '\0') if (msg == NULL || *msg == '\0')
msg = TR("Elaborazione in corso..."); msg = TR("Elaborazione in corso...");
pi = new TProgind(tot, msg, true, true); pi = new TProgress_monitor(tot, msg, true);
} }
freeze(true); freeze(true);
@ -1845,7 +1845,7 @@ bool TCursor::scan(CURSOR_SCAN_FUNC func, void* pJolly, const char* msg)
ok = false; ok = false;
break; break;
} }
if (pi != NULL && !pi->addstatus(1)) if (pi != NULL && !pi->add_status())
{ {
ok = false; ok = false;
break; break;

View File

@ -456,7 +456,8 @@ public:
bool scan(CURSOR_SCAN_FUNC func, void* pJolly = NULL, const char* msg = ""); bool scan(CURSOR_SCAN_FUNC func, void* pJolly = NULL, const char* msg = "");
// @cmember Costruttore // @cmember Costruttore
TCursor(TRelation* f, const char* filter = "", int key = 1, const TRectype* from = NULL, const TRectype* to = NULL, int tilde = 0x0); TCursor(TRelation* f, const char* filter = "", int key = 1,
const TRectype* from = NULL, const TRectype* to = NULL, int tilde = 0x0);
// @cmember Distruttore // @cmember Distruttore
virtual ~TCursor(); virtual ~TCursor();
}; };

View File

@ -870,16 +870,16 @@ static bool is_text_line(TString& str)
bool TTextfile::write_xls(const TFilename& xls) bool TTextfile::write_xls(const TFilename& xls)
{ {
int headerlen = printer().headersize(); const TPrinter& pr = printer();
const int footerlen = printer().footersize(); int headerlen = pr.headersize();
const int pagelen = printer().formlen(); const int footerlen = pr.footersize();
const int pagelen = pr.formlen();
TString str; TString str;
int tabstart = 1; int tabstart = 1;
int tabstop = pagelen - footerlen; int tabstop = pagelen - footerlen;
if (_lines < tabstop) tabstop = _lines; if (_lines < tabstop) tabstop = _lines;
int header_end = 12; int header_end = 12;
if (headerlen > 3) if (headerlen > 3)
header_end = headerlen; header_end = headerlen;
@ -924,13 +924,26 @@ bool TTextfile::write_xls(const TFilename& xls)
TToken_string riga(256, '\t'); TToken_string riga(256, '\t');
TString8 ext = pr.get_form_name().ext(); ext.lower();
const bool is_rep = ext == "frm" || ext == "rep";
ofstream out(xls); ofstream out(xls);
for (long j = 0; j < _lines; j++) for (long j = 0; j < _lines; j++)
{ {
const int row = j % pagelen; const int row = j % pagelen;
if (is_rep)
{
// Esporto la testata solo nella prima pagina e lascio il footer perchè nei form è variabile in lunghezza
if (row < headerlen && j >= pagelen)
continue;
}
else
{
// Esporto la testata solo nella prima pagina ed il footer solo nell'ultima // Esporto la testata solo nella prima pagina ed il footer solo nell'ultima
if ((row < headerlen && j >= pagelen) || (row >= pagelen-footerlen && row < _lines-pagelen)) if ((row < headerlen && j >= pagelen) || (row >= pagelen-footerlen && row < _lines-pagelen))
continue; continue;
}
read_line(j); read_line(j);
riga.cut(0); riga.cut(0);

View File

@ -638,7 +638,8 @@ void xvtil_statbar_set(
{ {
TToken_string t(80, '\t'); TToken_string t(80, '\t');
t.add(text); t.add(text);
if (prefix_valid() && main_app().get_firm() > 0) TApplication& a = main_app();
if (prefix_valid() && a.is_running() && a.get_firm() > 0)
{ {
t.add(prefix().firm().get(NDT_RAGSOC)); t.add(prefix().firm().get(NDT_RAGSOC));
} }
@ -648,7 +649,7 @@ void xvtil_statbar_set(
xvt_sys_get_profile_string(NULL, "Main", "Company", "", ragsoc.get_buffer(), ragsoc.size()); xvt_sys_get_profile_string(NULL, "Main", "Company", "", ragsoc.get_buffer(), ragsoc.size());
t.add(ragsoc); t.add(ragsoc);
} }
t.add(main_app().title()); t.add(a.title());
if (def) if (def)
statbar_set_default_title(_statbar, t); statbar_set_default_title(_statbar, t);
statbar_set_title(_statbar, t); statbar_set_title(_statbar, t);