Patch level : 10.0
Files correlati : bagn001a.msk Ricompilazione Demo : [ ] Commento : 0001607: 002422 - stampa schede Descrizione il bottone di esportazione excell non produce risultati; da impostazione stampante, scelgo di stampare su file, chiede il nome del file (che è già impostato) git-svn-id: svn://10.65.10.50/trunk@20431 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
448d7fa819
commit
0e70489f6b
@ -208,15 +208,15 @@ inline TObject& TArray::operator[] (int index) const
|
|||||||
|
|
||||||
#define FOR_EACH_ARRAY_ITEM(__arr, __r, __obj) \
|
#define FOR_EACH_ARRAY_ITEM(__arr, __r, __obj) \
|
||||||
TObject* __obj; \
|
TObject* __obj; \
|
||||||
for (int __r = __arr.first(); \
|
for (int __r = (__arr).first(); \
|
||||||
(__obj = __arr.objptr(__r)); \
|
(__obj = (__arr).objptr(__r)); \
|
||||||
__r = __arr.succ(__r))
|
__r = (__arr).succ(__r))
|
||||||
|
|
||||||
#define FOR_EACH_ARRAY_ITEM_BACK(__arr, __r, __obj) \
|
#define FOR_EACH_ARRAY_ITEM_BACK(__arr, __r, __obj) \
|
||||||
TObject* __obj; \
|
TObject* __obj; \
|
||||||
for (int __r = __arr.last(); \
|
for (int __r = (__arr).last(); \
|
||||||
(__obj = __arr.objptr(__r)); \
|
(__obj = (__arr).objptr(__r)); \
|
||||||
__r = __arr.pred(__r))
|
__r = (__arr).pred(__r))
|
||||||
|
|
||||||
|
|
||||||
class TPointer_array : public TArray
|
class TPointer_array : public TArray
|
||||||
|
@ -35,8 +35,7 @@ BEGIN
|
|||||||
PROMPT 1 4 "File "
|
PROMPT 1 4 "File "
|
||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
VALIDATE FILENAME_FUNC
|
VALIDATE FILENAME_FUNC
|
||||||
DSELECT
|
FSELECT ""
|
||||||
FLAGS "AM"
|
|
||||||
WARNING "E' necessario specificare un nome di file"
|
WARNING "E' necessario specificare un nome di file"
|
||||||
GROUP 2
|
GROUP 2
|
||||||
END
|
END
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <xvt.h>
|
#include <xvt.h>
|
||||||
|
|
||||||
#include <checks.h>
|
#include <checks.h>
|
||||||
|
#include <diction.h>
|
||||||
#include <keys.h>
|
#include <keys.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@ -178,9 +179,15 @@ int yesnocancel_box(
|
|||||||
|
|
||||||
bool cantread_box(const char* filename)
|
bool cantread_box(const char* filename)
|
||||||
{
|
{
|
||||||
return error_box("Impossibile leggere '%s'", filename);
|
return error_box(FR("Impossibile leggere '%s'"), filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cantwrite_box(const char* filename)
|
||||||
|
{
|
||||||
|
return error_box(FR("Impossibile scrivere '%s'"), filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// @doc EXTERNAL
|
// @doc EXTERNAL
|
||||||
// @msg __trace | Permette di mandare dei messaggi nel file trace.log
|
// @msg __trace | Permette di mandare dei messaggi nel file trace.log
|
||||||
bool __trace(
|
bool __trace(
|
||||||
|
@ -20,6 +20,7 @@ extern "C" {
|
|||||||
int yesnocancel_box(const char* fmt, ...);
|
int yesnocancel_box(const char* fmt, ...);
|
||||||
bool yesnofatal_box(const char* fmt, ...);
|
bool yesnofatal_box(const char* fmt, ...);
|
||||||
bool cantread_box(const char* filename);
|
bool cantread_box(const char* filename);
|
||||||
|
bool cantwrite_box(const char* filename);
|
||||||
bool __trace(const char* fmt, ...);
|
bool __trace(const char* fmt, ...);
|
||||||
bool __tracemem(const char* fmt);
|
bool __tracemem(const char* fmt);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -3823,14 +3823,10 @@ bool TForm::print(
|
|||||||
i++;
|
i++;
|
||||||
} // fine ciclo di stampa
|
} // fine ciclo di stampa
|
||||||
|
|
||||||
while (fixed_pages() && page(pr) % _npages !=0)
|
while (fixed_pages() && page(pr)%_npages)
|
||||||
{
|
{
|
||||||
pr.formfeed();
|
pr.formfeed();
|
||||||
/*
|
pr.skip(1);
|
||||||
static TPrintrow empty_line;
|
|
||||||
pr.print(empty_line);
|
|
||||||
*/
|
|
||||||
pr.skip(1); // No static when possible
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (from >= 0)
|
if (from >= 0)
|
||||||
|
@ -293,11 +293,11 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define FOR_EACH_SHEET_ROW(__sheet, __r, __riga) \
|
#define FOR_EACH_SHEET_ROW(__sheet, __r, __riga) \
|
||||||
TString_array& __sheet##__riga = (__sheet).rows_array(); \
|
TString_array& sheetof##__riga = (__sheet).rows_array(); \
|
||||||
FOR_EACH_ARRAY_ROW(__sheet##__riga, __r, __riga)
|
FOR_EACH_ARRAY_ROW(sheetof##__riga, __r, __riga)
|
||||||
|
|
||||||
#define FOR_EACH_SHEET_ROW_BACK(__sheet, __r, __riga) \
|
#define FOR_EACH_SHEET_ROW_BACK(__sheet, __r, __riga) \
|
||||||
TString_array& __sheet##__riga = (__sheet).rows_array(); \
|
TString_array& sheetof##__riga = (__sheet).rows_array(); \
|
||||||
FOR_EACH_ARRAY_ROW_BACK(__sheet##__riga, __r, __riga)
|
FOR_EACH_ARRAY_ROW_BACK(sheetof##__riga, __r, __riga)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1596,16 +1596,14 @@ bool TPrinter::printrow(
|
|||||||
TString rw;
|
TString rw;
|
||||||
if (rowtoprint != NULL)
|
if (rowtoprint != NULL)
|
||||||
{
|
{
|
||||||
rw = (_printertype == fileprinter) ? rowtoprint->row() : rowtoprint->row_codified();
|
//rw = (_printertype == fileprinter) ? rowtoprint->row() : rowtoprint->row_codified();
|
||||||
|
rw = rowtoprint->row_codified(); // Permetto di salvare anche su fileprinter = pippo.xls
|
||||||
rw.rtrim();
|
rw.rtrim();
|
||||||
}
|
}
|
||||||
|
|
||||||
int lun = rw.len ();
|
|
||||||
int idx;
|
|
||||||
|
|
||||||
if (_printertype != exportprinter)
|
if (_printertype != exportprinter)
|
||||||
{
|
{
|
||||||
for (idx = 0; idx < lun; idx++)
|
for (int idx = 0; rw[idx]; idx++)
|
||||||
{
|
{
|
||||||
if (rw[idx] == '@') // gestione data e n. di pagina
|
if (rw[idx] == '@') // gestione data e n. di pagina
|
||||||
{
|
{
|
||||||
@ -1629,7 +1627,7 @@ bool TPrinter::printrow(
|
|||||||
|
|
||||||
if (_printertype == screenvis)
|
if (_printertype == screenvis)
|
||||||
{
|
{
|
||||||
if (!_vf->frozen ())
|
if (!_vf->frozen())
|
||||||
_vf->add_line(rw);
|
_vf->add_line(rw);
|
||||||
else
|
else
|
||||||
_frozen = true;
|
_frozen = true;
|
||||||
@ -1984,8 +1982,36 @@ bool TPrinter::acrobatically_print_pdf(const TFilename& pdf) const
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TPrinter::auto_export(const TFilename& n)
|
||||||
|
{
|
||||||
|
TString ext = n.ext();
|
||||||
|
if (ext.blank())
|
||||||
|
return false;
|
||||||
|
ext.lower();
|
||||||
|
|
||||||
|
if (ext == "pdf")
|
||||||
|
{
|
||||||
|
print_pdf(_txt, n);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void TPrinter::close ()
|
if (ext.starts_with("xls"))
|
||||||
|
return _txt.write_xls(n);
|
||||||
|
|
||||||
|
if (ext == "txt")
|
||||||
|
{
|
||||||
|
ofstream txt(n);
|
||||||
|
for (long i = 0; i < _txt.lines(); i++)
|
||||||
|
txt << _txt.line(i) << '\n';
|
||||||
|
txt.close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TPrinter::close()
|
||||||
{
|
{
|
||||||
// la stampante era aperta e ho stampato qualcosa c'è footer da stampare
|
// la stampante era aperta e ho stampato qualcosa c'è footer da stampare
|
||||||
if (isopen() && _currentrow > 1 && _footersize > 0)
|
if (isopen() && _currentrow > 1 && _footersize > 0)
|
||||||
@ -1998,21 +2024,30 @@ void TPrinter::close ()
|
|||||||
print_txt(_txt);
|
print_txt(_txt);
|
||||||
break;
|
break;
|
||||||
case fileprinter:
|
case fileprinter:
|
||||||
|
if (_printerfile.full() && _txt.lines() > 0L)
|
||||||
{
|
{
|
||||||
FILE* fp = fopen(_printerfile, _appendfile ? "a" : "w");
|
bool done = false;
|
||||||
if (fp == NULL)
|
if (!_appendfile)
|
||||||
|
done = auto_export(_printerfile);
|
||||||
|
if (!done)
|
||||||
{
|
{
|
||||||
error_box(FR("Impossibile aprire il file %s"), (const char*)_printerfile);
|
FILE* fp = fopen(_printerfile, _appendfile ? "a" : "w");
|
||||||
return;
|
if (fp != NULL)
|
||||||
|
{
|
||||||
|
for (long i = 0; i < _txt.lines(); i++)
|
||||||
|
fprintf(fp,"%s\n", _txt.line(i));
|
||||||
|
fclose(fp);
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (long i = 0; i < _txt.lines(); i++)
|
if (done)
|
||||||
fprintf(fp,"%s\n", _txt.line(i));
|
message_box(FR("Stampa su file terminata. Nome archivio: %s"),(const char *)_printerfile);
|
||||||
fclose(fp);
|
else
|
||||||
message_box(FR("Stampa su file terminata. Nome archivio: %s"),(const char *)_printerfile);
|
cantwrite_box(_printerfile);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case exportprinter:
|
case exportprinter:
|
||||||
if (_exportfile.not_empty() && _txt.lines() > 0L)
|
if (_exportfile.full() && _txt.lines() > 0L)
|
||||||
{
|
{
|
||||||
ofstream txt(_exportfile);
|
ofstream txt(_exportfile);
|
||||||
for (long i = 0; i < _txt.lines(); i++)
|
for (long i = 0; i < _txt.lines(); i++)
|
||||||
|
@ -312,6 +312,8 @@ protected:
|
|||||||
bool printheader();
|
bool printheader();
|
||||||
// @cmember Stampa il footer della pagina
|
// @cmember Stampa il footer della pagina
|
||||||
bool printfooter();
|
bool printfooter();
|
||||||
|
// @cmember Esporta automaticamente nel formato deciso dalla estensione di n
|
||||||
|
bool auto_export(const TFilename& n);
|
||||||
|
|
||||||
// @access Public Member
|
// @access Public Member
|
||||||
public:
|
public:
|
||||||
@ -521,7 +523,7 @@ public:
|
|||||||
const TDate& getdate() const
|
const TDate& getdate() const
|
||||||
{ return _date; }
|
{ return _date; }
|
||||||
// @cmember Ritorna il tipo di output selezionato dall'utente per la stampa
|
// @cmember Ritorna il tipo di output selezionato dall'utente per la stampa
|
||||||
TPrtype printtype()
|
TPrtype printtype() const
|
||||||
{ return _printertype; }
|
{ return _printertype; }
|
||||||
// @cmember Setta il tipo di output selezionato dall'utente per la stampa
|
// @cmember Setta il tipo di output selezionato dall'utente per la stampa
|
||||||
void set_printtype(TPrtype dest)
|
void set_printtype(TPrtype dest)
|
||||||
|
@ -1547,10 +1547,10 @@ bool TBook::print_page(TWindow& win, size_t page)
|
|||||||
|
|
||||||
bool TBook::export_text(TFilename& fname, bool signature)
|
bool TBook::export_text(TFilename& fname, bool signature)
|
||||||
{
|
{
|
||||||
if (fname.ends_with(".pdf", true))
|
TString ext = fname.ext(); ext.lower();
|
||||||
|
if (ext == "pdf")
|
||||||
return export_pdf(fname, signature);
|
return export_pdf(fname, signature);
|
||||||
|
if (ext.starts_with("xls") || ext.starts_with("htm"))
|
||||||
if (fname.ends_with(".xls", true))
|
|
||||||
return export_excel(fname, signature);
|
return export_excel(fname, signature);
|
||||||
|
|
||||||
TToken_string str(1024, '=');
|
TToken_string str(1024, '=');
|
||||||
@ -1896,7 +1896,7 @@ void TBook::split_file(int colonne)
|
|||||||
ofstream out(temp);
|
ofstream out(temp);
|
||||||
TPointer_array index;
|
TPointer_array index;
|
||||||
|
|
||||||
close_output(); // Chiudo file di stampa eventualmente aperto
|
close_output(); // Chiudo file di stampa eventualmente aperto
|
||||||
ifstream ifs(_file); // Apro file di stampa da splittare
|
ifstream ifs(_file); // Apro file di stampa da splittare
|
||||||
|
|
||||||
TToken_string str(1024, '=');
|
TToken_string str(1024, '=');
|
||||||
@ -2278,10 +2278,11 @@ bool TBook::print_or_preview()
|
|||||||
switch (printer().printtype())
|
switch (printer().printtype())
|
||||||
{
|
{
|
||||||
case screenvis: ok = preview(); break;
|
case screenvis: ok = preview(); break;
|
||||||
|
case fileprinter:
|
||||||
case exportprinter:
|
case exportprinter:
|
||||||
{
|
{
|
||||||
TFilename f = printer().get_export_file();
|
TFilename f = printer().get_export_file();
|
||||||
ok = export_text(f, NULL);
|
ok = export_text(f, false);
|
||||||
if (ok)
|
if (ok)
|
||||||
xvt_sys_goto_url(f, "open");
|
xvt_sys_goto_url(f, "open");
|
||||||
}
|
}
|
||||||
@ -2290,7 +2291,10 @@ bool TBook::print_or_preview()
|
|||||||
{
|
{
|
||||||
TFilename f; f.tempdir(); f.add("tmp.pdf");
|
TFilename f; f.tempdir(); f.add("tmp.pdf");
|
||||||
if (export_pdf(f, false))
|
if (export_pdf(f, false))
|
||||||
|
{
|
||||||
printer().acrobatically_print_pdf(f);
|
printer().acrobatically_print_pdf(f);
|
||||||
|
f.fremove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: ok = print(); break;
|
default: ok = print(); break;
|
||||||
|
@ -876,11 +876,8 @@ bool TTextfile::write_xls(const TFilename& xls)
|
|||||||
{
|
{
|
||||||
str = cp;
|
str = cp;
|
||||||
const int len = str.len();
|
const int len = str.len();
|
||||||
if (str.full())
|
if (str.full() && str_type(str) > 0)
|
||||||
{
|
tab.add_field(x, len);
|
||||||
if (str_type(str) > 0)
|
|
||||||
tab.add_field(x, len);
|
|
||||||
}
|
|
||||||
x += len;
|
x += len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -938,7 +935,7 @@ void TTextfile::destroy ()
|
|||||||
_index = fopen (_indname, "w+b");
|
_index = fopen (_indname, "w+b");
|
||||||
if (_index == NULL || _instr == NULL)
|
if (_index == NULL || _instr == NULL)
|
||||||
{
|
{
|
||||||
error_box ("Impossibile aprire files temporanei");
|
cantwrite_box (_filename);
|
||||||
freeze ();
|
freeze ();
|
||||||
}
|
}
|
||||||
_isopen = TRUE;
|
_isopen = TRUE;
|
||||||
@ -971,7 +968,7 @@ TTextfile ::TTextfile (const char *file, int pagesize, direction preferred,
|
|||||||
|
|
||||||
if (_index == NULL || _instr == NULL)
|
if (_index == NULL || _instr == NULL)
|
||||||
{
|
{
|
||||||
yesnofatal_box ("Impossibile aprire files temporanei");
|
cantwrite_box(_filename);
|
||||||
freeze ();
|
freeze ();
|
||||||
}
|
}
|
||||||
if (!_istemp)
|
if (!_istemp)
|
||||||
@ -981,7 +978,7 @@ TTextfile ::TTextfile (const char *file, int pagesize, direction preferred,
|
|||||||
fwrite (&l, sizeof (long), 1, _index);
|
fwrite (&l, sizeof (long), 1, _index);
|
||||||
if (ferror(_index) || ferror(_instr))
|
if (ferror(_index) || ferror(_instr))
|
||||||
{
|
{
|
||||||
error_box("Errore di scrittura file temporaneo: scrittura interrotta");
|
cantwrite_box(_indname);
|
||||||
freeze();
|
freeze();
|
||||||
}
|
}
|
||||||
if (fgets (TEXT_TMP, TEXT_TMP_SIZE, _instr) == NULL)
|
if (fgets (TEXT_TMP, TEXT_TMP_SIZE, _instr) == NULL)
|
||||||
|
@ -168,9 +168,9 @@ void TVariable_rectype::write_memo(TIsam_handle file, const TRecnotype recno)
|
|||||||
void TVariable_rectype::add_field(TVariable_field * f)
|
void TVariable_rectype::add_field(TVariable_field * f)
|
||||||
{
|
{
|
||||||
CHECK(f, "Null field");
|
CHECK(f, "Null field");
|
||||||
CHECKS(!TRectype::exist(f->name()), "Field already exist ", f->name());
|
CHECKS(!TRectype::exist(f->name()), "Ambiuguous virtual/physical field ", f->name());
|
||||||
f->set_rec(this);
|
f->set_rec(this);
|
||||||
_virtual_fields.add(f->name(), f, TRUE);
|
_virtual_fields.add(f->name(), f, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TVariable_rectype::remove_field(const char * fieldname)
|
void TVariable_rectype::remove_field(const char * fieldname)
|
||||||
@ -251,38 +251,43 @@ bool TVariable_rectype::exist(const char* fieldname) const
|
|||||||
|
|
||||||
const TString & TVariable_rectype::get_str(const char* fieldname) const
|
const TString & TVariable_rectype::get_str(const char* fieldname) const
|
||||||
{
|
{
|
||||||
TVariable_field * f = (TVariable_field *) _virtual_fields.objptr(fieldname);
|
TVariable_field* f = (TVariable_field*) _virtual_fields.objptr(fieldname);
|
||||||
|
|
||||||
if (_memo_fld_to_load && f == NULL)
|
if (_memo_fld_to_load && f == NULL)
|
||||||
{
|
{
|
||||||
((TVariable_rectype *) this)->_memo_fld_to_load = false;
|
((TVariable_rectype*)this)->_memo_fld_to_load = false;
|
||||||
TToken_string values(get(_memo_fld), '\n');
|
TToken_string values(get(_memo_fld), '\n');
|
||||||
for (const char * s = values.get(0); s && *s; s = values.get())
|
for (const char * s = values.get(0); s && *s; s = values.get())
|
||||||
{
|
{
|
||||||
char * val = (char*)strchr(s, '='); //antica porcata
|
char* val = (char*)strchr(s, '='); //antica porcata
|
||||||
if (val)
|
if (val)
|
||||||
{
|
{
|
||||||
*val = '\0';
|
*val = '\0';
|
||||||
val++;
|
val++;
|
||||||
if (*val)
|
if (*val)
|
||||||
{
|
{
|
||||||
TVariable_field * v = (TVariable_field *) _virtual_fields.objptr(s);
|
TVariable_field* v = (TVariable_field*)_virtual_fields.objptr(s);
|
||||||
|
|
||||||
if (v == NULL)
|
if (v == NULL)
|
||||||
{
|
{
|
||||||
v = new TVariable_field(s);
|
if (TRectype::exist(s)) // Campo ex-virtuale ora diventato reale
|
||||||
((TVariable_rectype *) this)->add_field(v);
|
{
|
||||||
|
CHECKS(TRectype::get(s).empty(), "Campo ex-virtuale pieno ", s);
|
||||||
|
((TRectype*)this)->TRectype::put(s, val);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v = new TVariable_field(s);
|
||||||
|
((TVariable_rectype*)this)->add_field(v);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
v->force_value(val);
|
if (v != NULL)
|
||||||
|
v->force_value(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
f = (TVariable_field *) _virtual_fields.objptr(fieldname);
|
f = (TVariable_field*)_virtual_fields.objptr(fieldname);
|
||||||
}
|
}
|
||||||
if (f)
|
return f != NULL ? f->get() : TRectype::get_str(fieldname);
|
||||||
return f->get();
|
|
||||||
else
|
|
||||||
return TRectype::get_str(fieldname);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TVariable_rectype::put_str(const char* fieldname, const char* val)
|
void TVariable_rectype::put_str(const char* fieldname, const char* val)
|
||||||
|
@ -2228,10 +2228,10 @@ void TViswin::sel_to_clipboard()
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; i < txt.items(); i++)
|
for (i = 0; i < txt.items(); i++)
|
||||||
size += txt.row(i).len() + eol_len;
|
size += txt.row(i).len() + eol_len;
|
||||||
char* p = (char*)xvt_cb_alloc_data(size); // allocate clipboard
|
char* p = xvt_cb_alloc_data(size); // allocate clipboard
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
{
|
{
|
||||||
error_box("Impossibile allocare una clipboard di %ld bytes", size);
|
error_box(FR("Impossibile allocare una clipboard di %ld bytes"), size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// put data
|
// put data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user