Patch level : 12.0 nopatch
Files correlati : Commento : Esportazione in excel possibilità di scegliere i file. Migliorata formattazione stringe su più linee Aggiunti bottoni per esportazione nella aprintbar
This commit is contained in:
parent
8b92a8411c
commit
c2596b4fcc
@ -4,15 +4,39 @@ BEGIN
|
|||||||
PICTURE TOOL_PRINT
|
PICTURE TOOL_PRINT
|
||||||
END
|
END
|
||||||
|
|
||||||
|
#ifdef EXPORT
|
||||||
|
BUTTON DLG_EXPORT 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 1 "~Esporta"
|
||||||
|
PICTURE TOOL_EXPORT
|
||||||
|
END
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef EXPORT_EXCEL
|
||||||
|
BUTTON DLG_EXPORT_EXCEL 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT 3 1 "~Esporta"
|
||||||
|
PICTURE TOOL_EXCEL
|
||||||
|
END
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef EXPORT_PDF
|
||||||
|
BUTTON DLG_EXPORT_PDF 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT 4 1 "~Esporta"
|
||||||
|
PICTURE TOOL_PDF
|
||||||
|
END
|
||||||
|
#endif
|
||||||
|
|
||||||
BUTTON DLG_SETPRINT 2 2
|
BUTTON DLG_SETPRINT 2 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 1 "Imposta"
|
PROMPT 5 1 "Imposta"
|
||||||
PICTURE TOOL_SETPRINT
|
PICTURE TOOL_SETPRINT
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON DLG_PREVIEW 2 2
|
BUTTON DLG_PREVIEW 2 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 3 1 "~Anteprima"
|
PROMPT 6 1 "~Anteprima"
|
||||||
PICTURE TOOL_PREVIEW
|
PICTURE TOOL_PREVIEW
|
||||||
END
|
END
|
||||||
|
|
||||||
|
@ -51,6 +51,8 @@
|
|||||||
#define DLG_BARCODE_TYPE 47 /* TAG del tipo codice a barre */
|
#define DLG_BARCODE_TYPE 47 /* TAG del tipo codice a barre */
|
||||||
#define DLG_ALL 48 /* TAG del bottone Tutti */
|
#define DLG_ALL 48 /* TAG del bottone Tutti */
|
||||||
#define DLG_LOG 49 /* TAG del delle transazioni */
|
#define DLG_LOG 49 /* TAG del delle transazioni */
|
||||||
|
#define DLG_EXPORT_EXCEL 50 /* TAG del bottone Esporta in Excel */
|
||||||
|
#define DLG_EXPORT_PDF 51 /* TAG del bottone Esporta un pdf */
|
||||||
|
|
||||||
#define DLG_USER 100 /* TAG del primo controllo definito dall'utente */
|
#define DLG_USER 100 /* TAG del primo controllo definito dall'utente */
|
||||||
|
|
||||||
|
@ -873,9 +873,24 @@ int TBook::compute_text_frame(const TString& tmp, const TReport_font& font, TRep
|
|||||||
CHECK(w == PRINTER_WIN, "Finestra di stampa non valida");
|
CHECK(w == PRINTER_WIN, "Finestra di stampa non valida");
|
||||||
xvt_dwin_set_font(w, font.get_xvt_font(*_printwin));
|
xvt_dwin_set_font(w, font.get_xvt_font(*_printwin));
|
||||||
|
|
||||||
TToken_string p(tmp, '\n');
|
// TToken_string p(tmp, '\n');
|
||||||
|
TString int_tmp(tmp);
|
||||||
|
int pos = int_tmp.find('|');
|
||||||
|
|
||||||
|
while (pos >= 0)
|
||||||
|
{
|
||||||
|
int_tmp[pos] = 'ü';
|
||||||
|
pos = int_tmp.find('|', pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
TParagraph_string p(int_tmp, rect.width() /100);
|
||||||
|
|
||||||
FOR_EACH_TOKEN(p, line)
|
FOR_EACH_TOKEN(p, line)
|
||||||
|
{
|
||||||
|
while (char * s = (char *)strstr(line, "ü"))
|
||||||
|
*s = '|';
|
||||||
para.add(line);
|
para.add(line);
|
||||||
|
}
|
||||||
for (int i = 0; i < para.items(); i++)
|
for (int i = 0; i < para.items(); i++)
|
||||||
{
|
{
|
||||||
TString& row = para.row(i);
|
TString& row = para.row(i);
|
||||||
@ -1577,13 +1592,27 @@ bool TBook::print_page(TWindow& win, size_t page)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TBook::export_text(TFilename& fname, bool signature, int size)
|
|
||||||
|
HIDDEN bool ask_export_filename(TFilename& fname)
|
||||||
|
{
|
||||||
|
bool ok = false;
|
||||||
|
|
||||||
|
FILE_SPEC fs; xvt_fsys_convert_str_to_fspec(fname, &fs);
|
||||||
|
if (ok = (xvt_dm_post_file_save(&fs, TR("Esportazione")) == FL_OK))
|
||||||
|
xvt_fsys_convert_fspec_to_str(&fs, fname.get_buffer(), fname.size());
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TBook::export_text(TFilename& fname, bool signature, int size, bool goto_url, bool ask_filename)
|
||||||
{
|
{
|
||||||
TString ext = fname.ext(); ext.lower();
|
TString ext = fname.ext(); ext.lower();
|
||||||
if (ext == "pdf")
|
if (ext == "pdf")
|
||||||
return export_pdf(fname, signature);
|
return export_pdf(fname, signature, goto_url, ask_filename);
|
||||||
if (ext.starts_with("xls") || ext.starts_with("htm"))
|
if (ext.starts_with("xls") || ext.starts_with("htm"))
|
||||||
return export_excel(fname, signature);
|
return export_excel(fname, signature, goto_url, ask_filename);
|
||||||
|
|
||||||
|
if (ask_filename && !ask_export_filename(fname))
|
||||||
|
return false;
|
||||||
|
|
||||||
TToken_string str(1024, '=');
|
TToken_string str(1024, '=');
|
||||||
|
|
||||||
@ -1733,7 +1762,8 @@ bool TBook::export_text(TFilename& fname, bool signature, int size)
|
|||||||
if (xvt_sign_file(fname, outfile))
|
if (xvt_sign_file(fname, outfile))
|
||||||
fname = outfile;
|
fname = outfile;
|
||||||
}
|
}
|
||||||
|
if (goto_url)
|
||||||
|
xvt_sys_goto_url(fname, "open");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1772,10 +1802,13 @@ static void reformat_excel(TString& str)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TBook::export_excel(TFilename& fname, bool signature)
|
bool TBook::export_excel(TFilename& fname, bool signature, bool goto_url, bool ask_filename)
|
||||||
{
|
{
|
||||||
TTabulator tab;
|
TTabulator tab;
|
||||||
|
|
||||||
|
if (ask_filename && !ask_export_filename(fname))
|
||||||
|
return false;
|
||||||
|
|
||||||
int row = 0, col = 0, wid = 0;
|
int row = 0, col = 0, wid = 0;
|
||||||
TToken_string str(1024, '=');
|
TToken_string str(1024, '=');
|
||||||
|
|
||||||
@ -1890,6 +1923,8 @@ bool TBook::export_excel(TFilename& fname, bool signature)
|
|||||||
fname = outfile;
|
fname = outfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (goto_url)
|
||||||
|
xvt_sys_goto_url(fname, "open");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2208,15 +2243,18 @@ bool TBook::print(size_t pagefrom, size_t pageto, word copies)
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TBook::export_pdf(TFilename& filename, bool signature)
|
bool TBook::export_pdf(TFilename& filename, bool signature, bool goto_url, bool ask_filename)
|
||||||
{
|
{
|
||||||
bool ok = (pages() > 0) && main_app().has_module(RSAUT); // Controllo paranoico dei permessi
|
bool ok = (pages() > 0) && main_app().has_module(RSAUT); // Controllo paranoico dei permessi
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
|
if (ask_filename && !ask_export_filename(filename))
|
||||||
|
return false;
|
||||||
// Evita problemi di aggiornamento del pdf: deve sempre rigenerarlo!
|
// Evita problemi di aggiornamento del pdf: deve sempre rigenerarlo!
|
||||||
if (filename.exist() && !filename.fremove())
|
if (filename.exist() && !filename.fremove())
|
||||||
return cantwrite_box(filename);
|
return cantwrite_box(filename);
|
||||||
|
|
||||||
|
|
||||||
_pdf_file = filename;
|
_pdf_file = filename;
|
||||||
_pagefrom = 1;
|
_pagefrom = 1;
|
||||||
_pageto = 0;
|
_pageto = 0;
|
||||||
@ -2234,6 +2272,8 @@ bool TBook::export_pdf(TFilename& filename, bool signature)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (ok && goto_url)
|
||||||
|
xvt_sys_goto_url(filename, "open");
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2774,13 +2814,16 @@ void TReport_book::add_doc(const TString& name)
|
|||||||
if (name.ends_with(".rep", true)) // Tratto a parte i report!
|
if (name.ends_with(".rep", true)) // Tratto a parte i report!
|
||||||
{
|
{
|
||||||
TReport* eminem = new TReport;
|
TReport* eminem = new TReport;
|
||||||
|
|
||||||
if (eminem->load(name))
|
if (eminem->load(name))
|
||||||
{
|
{
|
||||||
TFilename msk = _report->filename().name();
|
TFilename msk = _report->filename().name();
|
||||||
|
|
||||||
msk.ext("msk");
|
msk.ext("msk");
|
||||||
if (_report->use_mask() && msk.custom_path())
|
if (_report->use_mask() && msk.custom_path())
|
||||||
{
|
{
|
||||||
TMask m(msk);
|
TMask m(msk);
|
||||||
|
|
||||||
_report->report2mask(m);
|
_report->report2mask(m);
|
||||||
eminem->mask2report(m);
|
eminem->mask2report(m);
|
||||||
}
|
}
|
||||||
@ -2788,9 +2831,11 @@ void TReport_book::add_doc(const TString& name)
|
|||||||
{
|
{
|
||||||
TRecordset* mainset = _report->recordset();
|
TRecordset* mainset = _report->recordset();
|
||||||
TRecordset* recset = eminem->recordset();
|
TRecordset* recset = eminem->recordset();
|
||||||
|
|
||||||
if (mainset && recset)
|
if (mainset && recset)
|
||||||
{
|
{
|
||||||
const TString_array& vars = mainset->variables();
|
const TString_array& vars = mainset->variables();
|
||||||
|
|
||||||
FOR_EACH_ARRAY_ROW(vars, i, name)
|
FOR_EACH_ARRAY_ROW(vars, i, name)
|
||||||
recset->set_var(*name, mainset->get_var(*name));
|
recset->set_var(*name, mainset->get_var(*name));
|
||||||
if (main_app().name().starts_with("ve1"))
|
if (main_app().name().starts_with("ve1"))
|
||||||
@ -2804,6 +2849,7 @@ void TReport_book::add_doc(const TString& name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
TReport* rep = _report; // Salvo variabile globale
|
TReport* rep = _report; // Salvo variabile globale
|
||||||
|
|
||||||
add(*eminem, true);
|
add(*eminem, true);
|
||||||
_report = rep; // Ripristino variabile globale
|
_report = rep; // Ripristino variabile globale
|
||||||
}
|
}
|
||||||
|
@ -97,9 +97,9 @@ public:
|
|||||||
virtual bool archive(const char* repname, bool signature);
|
virtual bool archive(const char* repname, bool signature);
|
||||||
virtual bool preview();
|
virtual bool preview();
|
||||||
|
|
||||||
virtual bool export_excel(TFilename& fname, bool signature);
|
virtual bool export_excel(TFilename& fname, bool signature, bool goto_url = false, bool ask_filename = false);
|
||||||
virtual bool export_pdf(TFilename& fname, bool signature);
|
virtual bool export_pdf(TFilename& fname, bool signature, bool goto_url = false, bool ask_filename = false);
|
||||||
virtual bool export_text(TFilename& fname, bool signature, int size);
|
virtual bool export_text(TFilename& fname, bool signature, int size, bool goto_url = false, bool ask_filename = false);
|
||||||
virtual bool send_mail(TFilename& fname, bool signature);
|
virtual bool send_mail(TFilename& fname, bool signature);
|
||||||
virtual bool esporta();
|
virtual bool esporta();
|
||||||
bool print_or_preview(); // Calls one of the above
|
bool print_or_preview(); // Calls one of the above
|
||||||
|
Loading…
x
Reference in New Issue
Block a user