Hi,

I would like to embed an Excel sheet in my view (EclipseRCP, SWT) and when it starts, I want to fill it with values. The embedding works. But how could I speak to individual cells or fill in and (Ideally) create a chart? I did it just to highlight a cell. I just can not find any documentation :(

Java Code:
import java.io.File;
 
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTError;
import org.eclipse.swt.ole.win32.OleAutomation;
import org.eclipse.swt.ole.win32.OleClientSite;
import org.eclipse.swt.ole.win32.OleFrame;
import org.eclipse.swt.ole.win32.Variant;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;
 
public class ExcelView extends ViewPart {
 
    public static final String ID = "ExcelSheet";
    private OleClientSite site;
 
    public ExcelView() {
    }
 
    @Override
    public void createPartControl(Composite parent) {
 
        try {
            OleFrame frame = new OleFrame(parent, SWT.NONE);
            File f = new File("d:\\test2.xls");
            site = new OleClientSite(frame, SWT.NONE, f);
            OleAutomation xls = new OleAutomation(site);
 
            int[] ids = xls.getIDsOfNames(new String[] { "ActiveSheet" });
            System.out.println(ids[0]);
            Variant sheet = xls.getProperty(ids[0]);
 
            // Den Range erstellen
            int rangeId = sheet.getAutomation().getIDsOfNames(new String[] { "Range" })[0];
            System.out.println("RANGE ID =" + rangeId);
            Variant[] arguments_1 = new Variant[1];
            arguments_1[0] = new Variant("D8");
            Variant range = sheet.getAutomation().getProperty(rangeId,arguments_1);
            
        
            int[] borderId = range.getAutomation().getIDsOfNames(new String[] { "Borders" });
            System.out.println("Borders ID =" + borderId);
            Variant border = range.getAutomation().getProperty(borderId[0]);
 
            int[] weightId = border.getAutomation().getIDsOfNames(new String[] { "Weight" });
            System.out.println("Weight ID =" + weightId);
            Variant weight = border.getAutomation().getProperty(weightId[0]);
 
            Variant[] arguments_2 = new Variant[1];
            arguments_2[0] = new Variant(-4138);
            border.getAutomation().setProperty(weightId[0], arguments_2);
            
            range.getAutomation().setProperty(weightId[0], arguments_2);
            
 
        } catch (SWTError e) {
            System.out.println("Unable to open activeX control");
            return;
        }
    }
 
    @Override
    public void setFocus() {
        // Have to set the focus see
        // [url]https://bugs.eclipse.org/bugs/show_bug.cgi?id=207688[/url]
        site.setFocus();
    }
 
}
I am grateful for any help

greetings,

tech