Aspose Cells OLE looses charts

Last post 02-09-2010, 7:28 AM by oraclede. 4 replies.
Sort Posts: Previous Next
  •  02-08-2010, 5:02 PM 221317

    Aspose Cells OLE looses charts Java

    Hi,
    switching from Aspose Cells 2.10 to 2.1.1 I faced the issue, that embedded charts in the OLE container vanish, meaning, that the worksheet with the chart becomes empty, while the data sheet is still there.
    The OLE is an excel chart, embedded in a 2003-style PPT, modified using Asposes Slides 2.1.0.
    This happens, if I extract the OLE stream, load a workbook and save this workbook back to the stream. Nothing else. Any idea? I don't want to stay with older versions, not at least for support reasons.
    Jens
     
  •  02-09-2010, 1:18 AM 221360 in reply to 221317

    Re: Aspose Cells OLE looses charts

    Attachment: Present (inaccessible)

    Hi,

    Thank you for considering Aspose.

    Please try the attached latest version of Aspose.Cells. If you still face any problem, please share your sample code and template file here. We will check it soon.

    Thank You & Best Regards,


    Nausherwan Aslam
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
  •  02-09-2010, 4:14 AM 221397 in reply to 221360

    Re: Aspose Cells OLE looses charts

    Hi,
    it's still having the same problem.
    Code is easy rebuild:
    the object, that gets loaded, is a "Microsoft Office Excel Chart" OLE-object.

    protected OleObjectFrame targetOleFrame = null;

    public CellsEditor(OleObjectFrame oleFrame) {
    targetOleFrame = oleFrame;
    }

    void openAndSave() {
    byte[] oleData = targetOleFrame.getObjectData();
    Workbook workbook = new Workbook();
    try {
    workbook.loadData(new ByteArrayInputStream(oleData));
    } catch (IOException ex) {
    Logger.getLogger(CellsEditor.class.getName()).log(Level.SEVERE, null, ex);
    }
    workbook.setCalculationMode(CalculationMode.AUTOMATIC);

    Worksheets worksheets = workbook.getWorksheets();
    Worksheet dataSheet = worksheets.getSheet("Sheet1");
    if (dataSheet == null) {
    dataSheet = worksheets.getSheet(0);
    }
    // here would come the work
    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    try {
    workbook.setCalculateBeforeSave(true);
    workbook.save(byteArrayOutputStream);
    } catch (IOException ex) {
    Logger.getLogger(CellsEditor.class.getName()).log(Level.SEVERE, null, ex);
    }

    targetOleFrame.setObjectData(byteArrayOutputStream.toByteArray());

    try {
    byteArrayOutputStream.close();
    } catch (IOException ex) {
    Logger.getLogger(CellsEditor.class.getName()).log(Level.SEVERE, null, ex);
    }
    }

    Jens

     
  •  02-09-2010, 6:29 AM 221419 in reply to 221397

    Re: Aspose Cells OLE looses charts

    Hi Jens,

    Please try Workbook.open() method instead of Workbook.loadData() method in your code.

    For your information, the drawing objects and other settings/attributes would not be imported when you use Workbook.loadData() method.

    Thank you.

    Amjad Sahi
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
  •  02-09-2010, 7:28 AM 221433 in reply to 221419

    Re: Aspose Cells OLE looses charts

    Thanks.
    I must have overseen that notice in the javadoc, regarding the methods. Or I just just the "stupid" shortcut of my IDE's proposal, that matched the data type.
    Whatever it was, since it worked in the previous version, I did not expect it to switch functionality.

    The naming part "Data" in "loadData" now gets a special meaning. that was not obvious for me in the first place.

    Jens
     
View as RSS news feed in XML