|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Dec 2006
Città: Lodi
Messaggi: 588
|
[JAVA] poi.apache scrittura file .doc e .xls (OFFRO LAVORO RETRIBUITO)
Ciao a tutti,
da poco ho iniziato ad utilizzare le poi.apache per la gestione dei file .doc e .xls. EXCEL: 1) come si imposta lo style della colonna per renderla nascosta? Ho provato così, ma non funziona....mi è venuto anche il dubbio ovviamente che è errata l'applicazione dello style "cshide" alla cell...devo forse applicarlo alla row? Se si come? Codice:
//Creo un Workbook
HSSFWorkbook wb = new HSSFWorkbook();
//Creo il foglio di lavoro
HSSFSheet sheet = wb.createSheet("Foglio1");
//Creo style Hidden
HSSFCellStyle cshide = wb.createCellStyle();
//Applico hide allo style Hidden
cshide.setHidden(true);
//Creo riga 1
row = sheet.createRow((short)1);
//Creo cella
cell = row.createCell((short)0);
//Imposto valore cella
cell.setCellValue("ciao");
//Imposto stato hide
cell.setCellStyle(cshide);
Codice:
//Creo style formato Euro
HSSFCellStyle cseuro = wb.createCellStyle();
//Creo formattazione
DataFormat format = wb.createDataFormat();
//Applico formattazione Euro allo style Euro
cseuro.setDataFormat(format.getFormat("\u0080 #.##0,0000"));
------------------------------------------------------------------ WORD: 1) Ho già sviluppato purtroppo una routine che in realtà genera un file .html con struttura proprio da file .html. Questo comunque è praticamente il file .html che genero tramite routine. Questo file se viene ridenominato cambiando estensione con .doc, se viene aperto con OpenOffice funziona tutto perfettamente, se viene aperto con MSOffice si perdono tutte le impaginazione, i margini, i font.... Codice:
<html><head><style type="text/css">@page{size: portrait; mso-page-orientation:portrait;}</style><title>Preventivo 001 </title></head><body><font face="Arial" size="2">
<img src="file:///C:/OEMB_Win/run/web/tomcat6026/webapps/OEMB/images/oemb/logo_fattura.PNG">
<br><br><br><br>
<b>A: </b> AZIENDA DI PROVA SRL
<br>
<b>Società: </b>VIA CAVOUR, 10
<br>
95100 CATANIA CT
<br>
77778888978
<br><br><br>
<b>Da: </b> SUPERMAN
<br>
<b>Società: </b>VIA MICHELINE, 2
<br>
37030 TAVAZZANO VR
<br>
Tel.+39 045 6151976 begin_of_the_skype_highlighting**************+39 045 6151976******end_of_the_skype_highlighting begin_of_the_skype_highlighting**************+39 045 6151976******end_of_the_skype_highlighting begin_of_the_skype_highlighting**************+39 045 6151976******end_of_the_skype_highlighting begin_of_the_skype_highlighting**************+39 045 6151976******end_of_the_skype_highlighting begin_of_the_skype_highlighting**************+39 045 6151976******end_of_the_skype_highlighting Fax. +39 045 6170073
<br>
E-mail: [email protected]
<br>
WEB: www.prova.it
<br><br><br><br><br>
<center><font size=6><b>OFFERTA N. 001 DEL 28/08/2010</b></font></center>
<br><br>
<b>Redatta da: </b>Pina
<br>
<b>Approvata da: </b>Fantozzi
<br><br><br><br><br>
<center>
<img src="file:///C:/OEMB_Win/run/web/tomcat6026/webapps/OEMB/images/oemb/aircompact.bmp" width="215px">
<img src="file:///C:/OEMB_Win/run/web/tomcat6026/webapps/OEMB/images/oemb/microcompact.bmp" width="215px">
<br><br><br><br><br><br><br>
<font size=2>
<b>Sede Amministrativa Via Micheline, 2 - 37030 Tavazzano (Verona) Italy; P.IVA e CF 12345678901</b>
<br>
[email protected] - www.prova.it
<br>
Tel. +39 045 6151976 - Fax +39 045 6170073
</font>
</font></body></html>
In alternativa, qualcuno di voi conosce bene le poi.apache per gestire i file .doc ed è in grado (dietro pagamento) di svilupparmi la routine che scrive correttamente il file? BeLakor
__________________
HWBot - BeLakor Il mio PC: alimentatore LC POWER Arkangel 850Watt, scheda video Gigabyte GTX 970 4GB OC WF3, SSD Samsung 850 PRO, 2 Velociraptor 300 GB in raid 1, ASRock X99 OC Formula, 16GB G.Skill Ripjaws 4 Series DDR4-2400, I7 5820K Ultima modifica di BeLakor : 07-09-2010 alle 18:18. |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Dec 2006
Città: Lodi
Messaggi: 588
|
Up
__________________
HWBot - BeLakor Il mio PC: alimentatore LC POWER Arkangel 850Watt, scheda video Gigabyte GTX 970 4GB OC WF3, SSD Samsung 850 PRO, 2 Velociraptor 300 GB in raid 1, ASRock X99 OC Formula, 16GB G.Skill Ripjaws 4 Series DDR4-2400, I7 5820K |
|
|
|
|
|
#3 |
|
Senior Member
Iscritto dal: Dec 2006
Città: Lodi
Messaggi: 588
|
Tutto risolto. Grazie a tutti per l'aiuto
BeLakor
__________________
HWBot - BeLakor Il mio PC: alimentatore LC POWER Arkangel 850Watt, scheda video Gigabyte GTX 970 4GB OC WF3, SSD Samsung 850 PRO, 2 Velociraptor 300 GB in raid 1, ASRock X99 OC Formula, 16GB G.Skill Ripjaws 4 Series DDR4-2400, I7 5820K |
|
|
|
|
|
#4 | |
|
Junior Member
Iscritto dal: Jun 2011
Messaggi: 3
|
Quote:
come sei riuscito a risolvere il problema della formattazione? Io sto provando con questo codice per formattare gli importi con i separatori delle migliaia e due decimali: Codice:
// Creazione stile
HSSFCellStyle csimporto = wb.createCellStyle();
// Creazione formattazione
DataFormat dfimporto = wb.createDataFormat();
// Applicazione formattazione
csimporto.setDataFormat(dfimporto.getFormat("#.##0,00"));
|
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 00:48.




















