cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Sascha,

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

Pranav

Former Member
0 Kudos

Hi,

my colleague can open the excel-file. We do not know why ?

Message was edited by: Sascha Buhmann

Former Member
0 Kudos

Are you sure yo have the file in the server in the given path?