Skip to Content
avatar image
Former Member

WebDynpor: OfficeControl Example, I cannot see the file...

Hi together,

I've tried the SAP example to call a MSOffice Document.

I've done the coding an implementation how it is shown in the sap example (http://help.sap.com/saphelp_nw04/helpdata/en/ef/3483789514b748b6fe1f145e9685ab/frameset.htm)

I've tried this two months ago and it works correctly.

Now I've tried it again and nothing happens. I've tried to call inplace and explace. No result....

My MSExplorer allows to call ActiveX - Components.

Could anybody help me.

I just want to show an Excel-File in my WebDynpro-Project.

Thank you so much.

Greetings Sascha

10 points for the solution.

😔 ... 200 pulse .... 😔

public void fillNode(IPrivateTestViewOfficeControl.IDocumentSourceNodeNode node, IPrivateTestViewOfficeControl.IContextElement parentElement)

{

//@@begin fillNode(IWDNode,IWDNodeElement)

ISimpleTypeModifiable mod = node.getNodeInfo().getAttribute("DocumentContent").getModifiableSimpleType();

ModifiableBinaryType bin = (ModifiableBinaryType)mod;

bin.setMimeType(new WebResourceType("xls", "application/msexcel", false));

// bin.setMimeType(WebResourceType.XLS);

// bin.setMimeType(new WebResourceType("xls", "application/ms-excel", false));

// bin.setMimeType(new WebResourceType("xls", "application/msexcel", false));

// bin.setMimeType(new WebResourceType("html", "text/html", false));

IPrivateTestViewOfficeControl.IDocumentSourceNodeElement element = node.createDocumentSourceNodeElement();

node.addElement(element);

try

{

byte[] bytes = getBytesFromFile(new File("C:
temp
besuchsbericht_template.xls"));

element.setDocumentContent(bytes);

}

catch (IOException e)

{

// do something

}

//@@end

}

public void onActiongetDocument(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActiongetDocument(ServerEvent)

WDOfficeControlMethods.showDocument(this.wdThis.wdGetAPI(),"OfficeControl1");

//@@end

}

//@@begin others

public static byte[] getBytesFromFile(File file)

throws IOException

{

FileInputStream is = new FileInputStream(file);

long length = file.length();

byte[] bytes = new byte[(int)length];

long bytesRead = is.read(bytes);

if (bytesRead < length)

{

throw new IOException("Could not completely read file "+file.getName());

}

is.close();

return bytes;

}

//@@end

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Jun 02, 2005 at 02:02 PM

    Hi Sascha,

    Which version of Web AS are you testing this example on?

    Pranav

    Add comment
    10|10000 characters needed characters exceeded