Comment modifier le format de date utilisée par un ReportClientDocument ?
Je charge un report par API java (code ci-dessous) .
Puis je l'execute
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 IEnterpriseSession oEnterpriseSession = CrystalEnterprise.getSessionMgr().logon("administrator", "", servRAS, "secEnterprise");; IInfoStore oInfoStore = (IInfoStore)oEnterpriseSession.getService("InfoStore"); IInfoObjects oInfoObjects = oInfoStore.query("Select * from CI_INFOOBJECTS where SI_PROGID = 'CrystalEnterprise.Report' and SI_INSTANCE = 0 and SI_NAME = '" + idMaquette + "'"); IReportAppFactory oReportAppFactory = (IReportAppFactory)oEnterpriseSession.getService("", "RASReportService"); oReportClientDocument.setLocale(java.util.Locale.FRANCE); try { IInfoObject oIInfoObject = (IInfoObject)oInfoObjects.get(0); oReportClientDocument = oReportAppFactory.openDocument(oIInfoObject, 0, java.util.Locale.ENGLISH); oReportClientDocument.getDatabaseController().logon(logDB, passDB); } catch (Exception e) { throw new Exception(" Erreur message :"+e); }
Le format des dates reste en anglais malgrès la modification de la local du report. (7, November 2007 par exemple au lieu de 7 Novembre 2007)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 PrintOutputController lePrintOutputController = oReportClientDocument.getPrintOutputController(); ReportExportFormat aReportExportFormat = ExportReport.getReportExportFormat("PDF"); ByteArrayInputStream byteIS = (ByteArrayInputStream)lePrintOutputController.export (aReportExportFormat);
Dans infoview l'execution de mon report s'effectue bien avec un format de date francaise, de même que l'apercu dans crystal report developper.
Comment modifier ce format de date utilisée par un ReportClientDocument ?
A noter que ma local par defaut (java.util.Locale.getDefault()) est bien "fr_FR"
Partager