Customize Checkin - Update a type with Excel sheet values

Kenrick
Kenrick Member
edited July 18, 2013 in Documentum #1

Hi,

I am busy customizing the checkin component.  When a user edits and checks in the imported spreadsheet, a type needs to be updated with the updated values from the spreadsheet.  I have tried using the code below to get the data from the repository:

try {

     IDfSysObject sysObj = (IDfSysObject)getDfSession().getObject(new DfId("0900303980006ccd"));
     ByteArrayInputStream bais = sysObj.getContent();
     if (bais.available() > 0)
     {
          System.out.println("// Data successfully fetched from the server...");
     }

//added code


    byte[] b = new byte[1];
    bais.read(b,0,1);
    int number;
    int linelength = 0;
    int item=0;
    do{

          number = bais.read();

          System.out.print(Character.toUpperCase((char)number));

          linelength++;
          if(linelength==25){
               System.out.println();
          }
          item++;
    }while(item < 100000);
    for (int countery = 0; countery < b.length; countery++) {

          System.out.println(b[countery]);
    }

} catch (DfException ex) {

     Logger.getLogger(CommitmentRegisterCheckin.class.getName()).log(Level.SEVERE, null, ex);

}

I got the code from the internet.  I tried testing the code by printing some characters to the log (i.e the added code).  There are rectangles and symbols printed in the logs and the characters are not in the spreadsheet.  Is the code correct?  How can I capture the updated information and update the type with that updated information?

Thanks. Kenrick.

Tagged:

Comments

  • christopher.imes
    edited July 17, 2013 #2

    Kenrick,

    Please consider moving this question as-is (no need to recreate) to the proper forum for maximum visibility.  Questions written to the users' own "Discussions" space don't get the same amount of attention and questions can go unanswered for a long time.

    You can do so by selecting "Move" under ACTIONS along the upper-right.  Then search for and select: "Documentum" (Developer Network) which would be the most relevant for this question.

  • Kenrick
    Kenrick Member
    edited July 17, 2013 #3

    Thanks, I moved it to Developer Network.

    Kenrick.

  • bacham2
    bacham2 Member
    edited July 17, 2013 #4

    That's because it's a binary file. You need to use a library such as Apache POI to extract information from the Excel file.

  • Kenrick
    Kenrick Member
    edited July 17, 2013 #5

    Where do I get the Excel file from (i.e. location, filepath)?

  • Hartmut_Clausen
    edited July 18, 2013 #6

    Use getFile() instead of getContent()