on 11-29-2016 4:11 PM
Hi Folks, I have the following code to Export into CSV file and it is all working fine, I just Need the last part where I can get the Content of the Media model and put it into CSV file, thanks for help
FileInputStream stream = null;
try
{
stream = new FileInputStream("C:/export.impex");
int content;
while ((content = stream.read()) != -1)
{
// convert to char and display it
System.out.println((char) content);
}
}
catch (final FileNotFoundException e2)
{
// YTODO Auto-generated catch block
e2.getMessage();
} // read your impex
final ExportConfig exportConfig = new ExportConfig();
exportConfig.setScript(new StreamBasedImpExResource(stream, "UTF-8"));
final ExportResult exportResult = exportService.exportData(exportConfig);
if (exportResult.isError())
{
throw new ImpExException("Error exporting CSV file");
}
final ImpExMediaModel mediaModel = exportResult.getExportedData();
final CSVWriter writer = new CSVWriter(new File("C:\\outlook.csv"), "utf-8");
final ImpExMedia scriptmedia = ImpExManager.getInstance().createImpExMedia("test_mediaexportscript");
scriptmedia.setFile(new File("C:/export.impex"));
scriptmedia.setFieldSeparator(';');
final ExportConfiguration config = new ExportConfiguration(scriptmedia, ImpExManager.getExportOnlyMode());
final Exporter exporter = new Exporter(config);
exporter.export();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.