Question

2
Replies
315
Views
PavanKumarB7453 Member since 2013 5 posts
Cooper Consulting
Posted: 4 years ago
Last activity: 4 years 7 months ago
Closed
Solved

Microsoft word merge not working with pega 7.1.8.

As you can see in the below code my logic is using i see my logic is using sWordManagerLaunchExternal which is in the prVisioInterface library.

In pega 7.1.8 the prVisioInterface library is blocked.

Are there any alternate methods to do the word merge.

<script for="window" event="onload">

alert('1');

SetupSettingsXML();

</script>

<script for="window" event="onbeforeunload">

try

{

/* Abhilash :check for closing of section before 10 seconds while downloading components for calls to avoid "line 0" error */

if( iCntr < 200 && iWaitRenav != 0){

clearTimeout( iWaitRenav);

}

if( bEditInProgress)

return "Word editing is in progress!\n*** Unsaved changes will be lost ***\nPress 'Cancel' to leave flowaction open.";

}

catch (e)

{

}

</script>

<script for="window" event="onunload">

try

{

ClearWordActiveX( );

}

catch (e)

{

}

</script>

<script for="WordActiveX" event="EditDocEvent( sEventCode, sEventData)">

if( sEventCode == "EditDocInitOK")

{

if( iWaitFailedLaunch != 0)

{

try

{

clearTimeout( iWaitFailedLaunch);

iWaitFailedLaunch = 0;

bEditInProgress = true;

ResetLaunchButton( true, "Editing in progress ...");

// alert( "The document is done loading" );

}

catch (e)

{

alert(" Error in WordActiveX event handler: " + e.description);

}

}

}

else if( sEventCode == "EditDocClosed")

{

try

{ bEditInProgress = false;

/* added by Abhilash */

try { top.window.focus(); } catch(e) {}

var oTextArea = document.all( "TextToEdit");

oTextArea.value = document.all( "WordActiveX").sGetEncodedBinaryFile( sEditedDocPath);

oSettingsXML.selectSingleNode("//pySkipExternalInit").text = "true";

setTimeout('RenavigateWordActiveX( "")', 20);

}

catch (e)

{

alert(" Error in WordActiveX event handler: " + e.description);

}

setTimeout('ResetLaunchButton( false, "Edit Document", true)', 200);

}

</script>

<script>

var iWaitFailedLaunch = 0;

var bEditInProgress = false;

var sEditedDocPath = "";

var iCntr=0;

var sMsg="";

var iWaitRenav=0;

var iWaitDoExtLaunch=0;

function HandleFailedLaunch()

{

try

{

iWaitFailedLaunch = 0;

alert( "There was a problem launching PRPC Word Editor.");

}

catch (e)

{

alert("Error in HandleFailedLaunch: " + e.description);

}

ResetLaunchButton( false, "Edit Document", true);

bEditInProgress = false;

}

// Get URL encryption information.

function getURLencryptToken() {

try {

var sEncryptToken = "";

if(typeof bEncryptURLs != "undefined" && bEncryptURLs) {

sEncryptToken = getCookie();

}

return sEncryptToken;

}

catch(e) { return ""; }

}

function DoLaunchExtWord()

{

try

{

alert('11');

var oWordActiveX = ConstructWordActiveX( );

alert(oWordActiveX);

if( oWordActiveX == null)

{alert('12');

return;}

alert('13');

oSettingsXML.selectSingleNode("//pyEditedPath").text = sEditedDocPath;

alert(sEditedDocPath);

alert('14');

/* Get URL encryption key and pass to ActiveX, which will transfer it to the Word VBA */

var sEncryptToken = getURLencryptToken();

alert(sEncryptToken);

if(sEncryptToken != "") {

alert('18')

oSettingsXML.selectSingleNode("//pyEncryptToken").text = sEncryptToken;

alert(sEncryptToken);

oSettingsXML.selectSingleNode("//pyEncryptEnable").text = "true";

}

/* Launch external Word session. Process external launch return code. */

alert('19');

var oTextArea = document.all( "TextToEdit");

alert(oTextArea);

var sTemplateName = document.all("TemplateName").value;

alert(sTemplateName);

bEditInProgress = true;

alert('20');

var sRetVal = oWordActiveX.sWordManagerLaunchExternal( WordEditDiv, oSettingsXML, sTemplateName, oTextArea.value);

alert(sRetVal) ;

if( sRetVal == "ERROR")

{

alert('21') ;

ResetLaunchButton( false, "Edit Document");

}

else

{

alert('22');

iWaitFailedLaunch = setTimeout('HandleFailedLaunch()', 15000);

sEditedDocPath = sRetVal;

}

if( iWaitDoExtLaunch != 0)

{

clearTimeout(iWaitDoExtLaunch);

iWaitDoExtLaunch = 0;

}

}

catch (e)

{

if( e.number==-2146827850){

/* Abhilash :loop till 10 seconds elapsed for RenavigateWordOCX() API for downloading component. sMsg will be null till 10 seconds. */

if( sMsg == "")

{

iWaitDoExtLaunch=setTimeout('DoLaunchExtWord()', 600);

}

}

else

{

ResetLaunchButtons( false, "Edit");

alert("Error in DoLaunchExtWord: " + e.description);

}

}

}

/* Launch exernal Word session. */

function LaunchExtWord()

{

try

{

alert('6');

RenavigateWordActiveX( "BeingEditedMsg");

alert('7');

setTimeout('ResetLaunchButton( true, "Launching Word")', 20);

alert('8');

ResetLaunchButton( true, "Launching Word. Please wait...");

alert('9');

setTimeout('DoLaunchExtWord()', 400);

alert('10');

}

catch (e)

{

alert("Error in LaunchExtWord: " + e.description);

}

}

/* Dynamically construct Word ActiveX object */

function ConstructWordActiveX( )

{

try

{

alert('15');

var oWordActiveXDiv = document.all( "WordEmDiv");

alert(oWordActiveXDiv);

var oWordActiveX = oWordActiveXDiv.all( "WordActiveX");

alert(oWordActiveX);

if( oWordActiveX)

{alert('16');

return oWordActiveX;}

alert('17') ;

/* Calculate textarea extent in twips. */

var oTextArea = document.all( "TextToEdit");

var extX = oTextArea.offsetWidth * 26.5;

var extY = oTextArea.offsetHeight * 26.5;

/* Recreate Word ActiveX object. */

oWordActiveXDiv.innerHTML = '<div id=oOcxDiv style="position:absolute; visibility:visible;">' +

'<object classid="clsid:BE8EEE38-A7C5-4674-A6C4-C2D7421FDD10" ' +

' codebase="prvisiointerface.cab#version=5,4,0,20"id=WordActiveX>' +

'<param name="_ExtentX" value="' + extX + '">' +

'<param name="_ExtentY" value="' + extY + '">' +

'<span id="VisioInterfaceFail" style="color:red">PegaRULES Office Interface Control Load Failure!</span>' +

'</object></div>';

return oWordActiveXDiv.all( "WordActiveX");

}

catch (e)

{

alert("Error in ConstructWordActiveX: " + e.description);

return null;

}

}

/* Navigate to fixed document ActiveX. */

function RenavigateWordActiveX( sFile)

{

try

{

var oWordActiveX = document.all( "WordActiveX");

iCntr++;

if( oWordActiveX != null)

oWordActiveX.bRenavigateBrowserControl( sFile);

sMsg="";

/* making counter zero if all well. */

iCntr=0;

if( iWaitRenav != 0)

{

clearTimeout(iWaitRenav);

iWaitRenav =0;

}

}

catch(e)

{

/* added by Abhilash . Error number corresponds "Object Doesnot Support this Property or Method" */

/* usually this happens when API Not found in Component or Conponent is not loaded yet. */

if( e.number==-2146827850){

/* Abhilash : checking for 10 seconds. ( 50ms * 200 = 10000ms i.e 1s.) */

if( iCntr>200)

{

sMsg="failed to load prVisioInterface control";

alert(sMsg);

}

else

{

iWaitRenav=setTimeout('RenavigateWordOCX()', 50);

}

}

else

{

alert("Error in RenavigateWordOCX: " + e.description);

}

}

}

/* Navigate to blank and unload ActiveX. */

function ClearWordActiveX( )

{

try

{

var oOcxDiv = document.all( "WordEmDiv");

var oWordActiveX = oOcxDiv.all( "WordActiveX");

if( oWordActiveX != null)

{

oWordActiveX.bRenavigateBrowserControl( "");

oOcxDiv.parentElement.removeChild( oOcxDiv);

}

}

catch(e)

{

alert("Error in ClearWordActiveX: " + e.description);

}

}

/* Setup Settings XML. */

function SetupSettingsXML()

{

try

{

alert('2') ;

oSettingsXML.selectSingleNode("//pySiteMinderCookie").text =

sGetCookie( oSettingsXML.selectSingleNode("//pySiteMinderHeader").text);

alert( oSettingsXML.selectSingleNode("//pySiteMinderHeader").text);

alert('3');

}

catch(e)

{

alert("Error in SetupSettingsXML: " + e.description);

}

}

/* Disable/Enable external edit launch buttons. */

function ResetLaunchButton( bDisable, sCaption, bHide)

{

try

{

var oButton = null;

oButton = document.all("LaunchExtSession");

oButton.disabled = bDisable;

oButton.value = sCaption;

if ( bHide )

oButton.style.display = "none";

}

catch (e)

{

alert(" Error in ResetLaunchButton: " + e.description);

}

}

function sGetCookie ( sCookieName) {

var results = document.cookie.match ( sCookieName + '=(.*?)(;|$)' );

if ( results )

return ( unescape ( results[1] ) );

else

return "";

}

</script>

<script>

function launchTemplate ( )

{

alert('4');

var templateName = document.getElementById( "TemplateName" ).value;

alert(templateName);

LaunchExtWord( templateName );

alert('5');

}

</script>

<style>

.wordIcon

{ background-image: url("webwb/microsoft_word_icon.png");

background-position: 0px 0px;

background-repeat: no-repeat;

width: 16px;

height: 16px;

}

.hideWordIcon

{ background-image: none;

}

</style>

<table width="100%" cellspacing="0" cellpadding="2" border="0">

<tr><td colspan="2" style="height: 10px;"><input id="TemplateName" type="hidden" value='<%= tools.getParamValue("TemplateName") %>'>

</td></tr>

<tr><td> </td><td style="height: 22px;">

<style>

.wordIcon

{ background-image: url("webwb/microsoft_word_icon.png");

background-repeat: no-repeat;

width: 16px;

height: 16px;

}

.buttonUnderLine

{ text-decoration: underline;

}

</style>

<BUTTON title='Click to create <%= tools.getParamValue("TemplateName") %>' id="LaunchExtSession" name="LaunchExtSession" onclick="launchTemplate();">

<SPAN style="vertical-align:middle" class="wordIcon"> </SPAN>

<span style="vertical-align:middle" class="buttonText" onmouseover="this.className='buttonUnderLine'" onmouseout="this.className='buttonText'"><b><font color=blue size=2>Create Document</font></b></span>

</BUTTON>

</td></tr>

</table>

<xml id=oSettingsXML>

<?xml version="1.0"?>

<pega:include type="Rule-Obj-XML" name="WordManager_Settings.Generic"/>

</xml>

***Updated by moderator: Lochan to add Categories***

Data Integration Java and Activities User Interface
Moderation Team has archived post
Share this page LinkedIn