It is currently Tue Feb 09, 2010 8:25 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: NAV 4.0, Localized Excel and property Formula
PostPosted: Tue Aug 07, 2007 8:40 am 
Offline

Joined: Tue Aug 07, 2007 8:11 am
Posts: 2
Location: Trutnov
Country: Czech Republic (cz)
Because in NAV is a small bug which don't allow write to property Formula of Cell US expression then it's big problem write transparent international application with localized Excel.

I found a small trick how to get subfolders for any folder though NAV don't know FOR EACH - Windows Script Host Object Model Folders and Files.

There is result:
variables:
Name DataType Subtype Length
loScript Automation 'Microsoft Script Control 1.0'.ScriptControl
lcCode Text 1024
loData Automation 'Microsoft Scripting Runtime'.Dictionary
lcPom Text 1024
lii Integer


Code: Select all
CREATE(loData);
CREATE(loScript);
lcCode :='loCell.Formula=loList.Item(1);';
lii:=1;

// for each cell
XlCell:=XlWrkSht.Range(xlColID + xlRowID);

loScript.Language := 'JScript';
// Add objects
loScript.AddObject('loCell', XlCell); // excel cell
loScript.AddObject('loList', loData); // dictionary object

lcPom:=GetFormula(); // Formula definition
loData.Add(lii,lcPom); // Add formula to dictionary object
loScript.ExecuteStatement(lcCode); // Execute javascript
loData.RemoveAll(); // remove item from dictionary
loScript.Reset(); // reset Script object for next using


MartinaJ


Top
 Profile  
 
 Post subject: Hi Martina
PostPosted: Wed Aug 08, 2007 10:52 am 
Offline

Joined: Tue Aug 07, 2007 10:06 am
Posts: 22
Location: New Delhi
Country: India (in)
Nice meeting you.

I have tried with the example you provided. But I did't able to compile the code because of 'GetFormula()' Function it is not defined from where this function has to be called.

Please, Provide the Solution for this.

Regards,
kiran.

_________________
Hi


Top
 Profile  
 
 Post subject: kirankumar
PostPosted: Fri Aug 10, 2007 6:38 am 
Offline

Joined: Tue Aug 07, 2007 8:11 am
Posts: 2
Location: Trutnov
Country: Czech Republic (cz)
I'm sorry. GetFormula is trigger from table 370 (Excel Buffer)

Code: Select all
CREATE(loData);
CREATE(loScript);
lcCode :='loCell.Formula=loList.Item(1);';
lii:=1;

// for each cell
XlCell:=XlWrkSht.Range('C5');

loScript.Language := 'JScript';
// Add objects
loScript.AddObject('loCell', XlCell); // excel cell
loScript.AddObject('loList', loData); // dictionary object


loData.Add(lii,'=SUM(C1:C4)'); // Add formula to dictionary object
loScript.ExecuteStatement(lcCode); // Execute javascript
loData.RemoveAll(); // remove item from dictionary
loScript.Reset(); // reset Script object for next using


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group