web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Converting rdl file to word and upload to azure

(0) ShareShare
ReportReport
Posted on by

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);


}

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    PranavShroti Profile Picture
    4,510 on at

    Check with a breakpoint.. if this line is returning any value: var bytes = new Uint8Array(this.response);

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans