Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Converting rdl file to word and upload to azure

$
0
0

Hi,

I have created rdl file. I want to convert it to word format and upload to azure...

I have converted from rdl file to word format and upload to azure.. 

But I am getting the error message: "index was out of range. must be non-negative and less than the size of the collection"

Below are the code

function encodePdf(responseSession) {

var pth, bdy;

var retrieveEntityReq = new XMLHttpRequest();

pth = ServerURL + "/Reserved.ReportViewerWebControl.axd?ReportSession=" + responseSession[0] + "&Culture=1033&CultureOverrides=True&UICulture=1033&UICultureOverrides=True&ReportStack=1&ControlID=" + responseSession[1] + "&OpType=Export&FileName=Test&ContentDisposition=OnlyHtmlInline&Format=WORD";

retrieveEntityReq.open("GET", pth, true);

retrieveEntityReq.setRequestHeader("Accept", "*/*");

retrieveEntityReq.responseType = "arraybuffer";

retrieveEntityReq.onreadystatechange = function () {

if (retrieveEntityReq.readyState == 4 && retrieveEntityReq.status == 200) {

var binary = "";

var bytes = new Uint8Array(this.response);

for (var i = 0; i < bytes.byteLength; i++) {

binary += String.fromCharCode(bytes[i]);

}

if (bdy != null) {


UploadDocument(bdy);
}

}

};

retrieveEntityReq.send();

}

function UploadDocument(bdy) {

file = bdy;
var formData = new FormData;
formData.append('file', file);
var recordId = parent.window.Xrm.Page.data.entity.getId();
var userId = parent.window.Xrm.Page.context.getUserId();
formData.append('id', recordId);
formData.append('userId', userId);
formData.append('type', 'file');
var req = new XMLHttpRequest();
req.open("POST", getStorageServer() + 'Upload.aspx', true); // Getting the azure site url
req.onreadystatechange = function () {
if (req.readyState === 4 /* complete */) {
req.onreadystatechange = null; //Addresses potential memory leak issue with IE
if (req.status === 200) {
if (req.responseText.startsWith("OK")) {
alert('File content was uploaded.');
}
else {

alert(req.responseText);
}
}
}
};
req.send(formData);


}


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images