Text length for Style Sheet ToolW11.1

krzychub83
Member Posts: 120
I would like to transfer blob memo fields through Style Sheet ToolW11.1 to Ms Word. I expect memos about 10kB length. This tool does not support blobs, so I must modify codeunit 682 (Style Sheet Data Management).
variables: BSTRConv as 'Navision Attain Hash 1.0'.BSTRConverter
ChildNode as 'Microsoft XML, v4.0'.IXMLDOMNode
ChildNode := ParentNode.ownerDocument.createNode('element',NodeName,'');
CREATE(BSTRConv);
WHILE NodeTextStream.EOS = FALSE DO BEGIN
NodeTextStream.READTEXT(temp, 1024);
BSTRConv.AppendNextStringPortion (temp);
END;
ChildNode.text (BSTRConv.BSTR); //error at this line
ParentNode.appendChild(ChildNode);
CreatedChildNode := ChildNode;
When stream has more than 1024 characters, I’ve got an error: “The length of the text string exceeds the size of the string buffer”.
Is any way to solve this problem?
PS: NAV 5.0 SP1
variables: BSTRConv as 'Navision Attain Hash 1.0'.BSTRConverter
ChildNode as 'Microsoft XML, v4.0'.IXMLDOMNode
ChildNode := ParentNode.ownerDocument.createNode('element',NodeName,'');
CREATE(BSTRConv);
WHILE NodeTextStream.EOS = FALSE DO BEGIN
NodeTextStream.READTEXT(temp, 1024);
BSTRConv.AppendNextStringPortion (temp);
END;
ChildNode.text (BSTRConv.BSTR); //error at this line
ParentNode.appendChild(ChildNode);
CreatedChildNode := ChildNode;
When stream has more than 1024 characters, I’ve got an error: “The length of the text string exceeds the size of the string buffer”.
Is any way to solve this problem?
PS: NAV 5.0 SP1
0
Comments
-
If you haven't already noticed, Navision has many limitations. The 1024 buffer limitation with passing information via OCX/Automations (as well as similar cap on local data, aside from Blob & BigText)
You did, however, overlook the fact that Microsoft XML (MSXML) Automation allows streams.
(I've gotta make a b-line for the door since I'm off work but here is some code. I am sure you will find what you are looking for in this example)//tblob's are TempBlob records (Temporary = YES) tblob.Blob.CREATEOUTSTREAM(ostream); tblob.Blob.CREATEINSTREAM(istream); tblobb.Blob.CREATEINSTREAM(istreamb); tblobb.Blob.CREATEOUTSTREAM(ostreamb); //Large file I have (26k) for test tblobb.Blob.IMPORT('C:\Documents And Settings\myname\Desktop\txt.txt'); ostream.WRITETEXT('<MyXML><cNode>'); ostream.WRITETEXT(); bt.READ(istreamb); bt.WRITE(ostream); ostream.WRITETEXT('</cNode></MyXML>'); IF ISCLEAR(xmldom) THEN CREATE(xmldom); IF ISCLEAR(xmldomm) THEN CREATE(xmldomm); xmldom.load(istream); //<-- Here's where you will benefit the most :D xmlnode := xmldom.selectSingleNode('//MyXML/cNode'); xmldomm.loadXML('<dummynode></dummynode>'); xmlele := xmldomm.documentElement; xmlele.AppendChild(xmlnode); xmldomm.save('C:\Documents And Settings\myname\Desktop\result.txt'); //Output to see the results CLEAR(xmldom); CLEAR(xmldomm);
0 -
Thanks for this example. I understand the idea. But I’m not sure, if I found proper types for xml* variables.
I’ve declared xmldom as 'Microsoft XML, v4.0'.IXMLDOMDocument2, but I’ve got error message: Could not create an instance of the OLE control or Automation server identified by GUID {guid} 4.0: {guid}: ‘Microsoft XML, v4.0’.IXMLDOMDocument2.0 -
Declare xmldom (or whatever you want to name it) as 'Microsoft XML, v4.0'.DOMDocument
And make sure to create an instance of the automation...IF ISCLEAR(xmldom) THEN CREATE(xmldom);
0 -
THX for reply
I menage to overcome this problem but now I have another error, which I don't know how to solve.[i]AddElementBlob(ParentNode,NodeName,NodeTextStream,CreatedChildNode)[/i] //preapre stream for xml tmp680."Style Sheet Document".CREATEINSTREAM (sin1); tmp680."Style Sheet Document".CREATEOUTSTREAM (sout1); sout1.WRITETEXT('<document><'+NodeName+'>'); sout1.WRITETEXT(); bt.READ (NodeTextStream); bt.WRITE (sout1); sout1.WRITETEXT('</'+NodeName+'></document>'); //end: preapre stream for xml // ChildNode := ParentNode.ownerDocument.createNode('element',NodeName,''); IF ISCLEAR(xmldom) THEN CREATE(xmldom); xmldom.load(sin1); ChildNode := xmldom.selectSingleNode('//document/'+NodeName+''); // ERROR AT THIS LINE: ParentNode.appendChild(ChildNode); CreatedChildNode := ChildNode; CLEAR(xmldom);
The Error popup says:
The call to member appendChild failed. msxml4.dll returned the fallowing message:
It is an error to mix objects from different versions of MSXML0 -
Make sure your Microsoft XML automation variables are all of the same MSXML version.0
-
Make sure your Microsoft XML automation variables are all of the same MSXML version.
They are of the same version. But thank You for a try. Maybe some other ideas...0 -
Paste your variable declarations & code please0
-
Had the same error message "Make sure your Microsoft XML automation variables are all of the same MSXML version", when I was trying to run Style Sheet Tool 2.0 on 5.0 SP1 client.
Downgrading automation variables from "'Microsoft XML, v6.0'.DOMDocument60" to "'Microsoft XML, v4.0'.DOMDocument40" solved the issue...0 -
Bibo wrote:Downgrading automation variables from "'Microsoft XML, v6.0'.DOMDocument60" to "'Microsoft XML, v4.0'.DOMDocument40" solved the issue...Martin Bokůvka, AxiomProvis0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions