Quantcast
Channel: SCN: Message List - Java SDK Application Development
Viewing all articles
Browse latest Browse all 2284

JAVA SDK - export to excel issue

$
0
0

Hello All,

 

I have met some troubles during export to excel developing.

 

Program works fine but I am quite surprised the final view of the excel file.

 

The main code:

    IEnterpriseSession enterpriseSession = null;        ReportEngines reportEngines = null;                loadConnectionProperties(args[0]);                System.out.println("Host: " +host);        System.out.println("User name: " +user);        System.out.println("Password: " +pass);        System.out.println("Authentication: " +auth);                try {                          File folder = new File(args[1]);              File[] listOfFiles = folder.listFiles();                 ISessionMgr sessionMgr = CrystalEnterprise.getSessionMgr();                enterpriseSession = sessionMgr.logon(user, pass, host, auth);                if(enterpriseSession!= null){                reportEngines = (ReportEngines) enterpriseSession.getService("ReportEngines");                ReportEngine reportEngine = (ReportEngine) reportEngines.getService(ReportEngines.ReportEngineType.WI_REPORT_ENGINE);                                IInfoStore infoStore = (IInfoStore) enterpriseSession.getService("InfoStore");                String query = "select SI_ID, SI_NAME, SI_FILES from CI_INFOOBJECTS where SI_KIND = 'Webi' and SI_INSTANCE=0";                IInfoObjects infoObjects = (IInfoObjects) infoStore.query(query);                           for (int i = 0; i < listOfFiles.length; i++)               {                            if (listOfFiles[i].isFile() && listOfFiles[i].getAbsoluteFile().toString().endsWith(".properties"))                {                    HashMap<String, String[]> answers = loadReportParametersAndName(listOfFiles[i].getAbsolutePath().toString());                                            for (Object object : infoObjects) {                        IInfoObject infoObject = (IInfoObject) object;                        String path = getInfoObjectPath(infoObject);                                                                        if (path.endsWith(reportPath.substring(reportPath.lastIndexOf("- "), reportPath.length()))) {                                                        String title = infoObject.getTitle();                                                        DocumentInstance doc = reportEngine.openDocument(infoObject.getID());                                                        doc.refresh();                                                        Prompts prompts = doc.getPrompts();                            for (int i1 = 0; i1 < prompts.getCount(); i1++) {                                                                Prompt prompt = prompts.getItem(i1);                                                                                String[] answer = answers.get(prompt.getID());                                System.out.print (prompt.getID());                                if (answer != null) {                                    prompt.enterValues(answer);                                    for (String value : answer) {                                        System.out.println(" " + value);                                    }                                                        }                            }                            doc.setPrompts();                                                                                   com.businessobjects.rebean.wi.DataProviders providers = doc.getDataProviders();                            int sum=0;                            for(int i1 = 0; i1 < providers.getCount();i1++){                                sum+=providers.getItem(i1).getDuration();                                                    }                                                    BinaryView xlsView = (BinaryView)doc.getView(OutputFormatType.XLS);                                                                                    writeBytes(xlsView.getContent(), args[2]+"/"+title + "_"+i+".xls");               }          }          }
}

 

As I mentioned program works and generates excel. However, the problem regards the final excel columns. The are multiplied or merged. Please have a look at the attached file - why does SDK generate columns like AW? What is interesting there is no such kind of issue during exporting to excel in InfoView.

 

SAP: BI4.0 SP02
OS: Linux RedHat 5.2

 

 

Thank you in advance.


Viewing all articles
Browse latest Browse all 2284

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>