Ran out of memory Error


#1

Hi I’m using classic ASP to try to generate a MailMerge with a text file. In the last version this worked fine, but I updated because I wasn’t sure if I needed the new version to use the overloaded Save_4 function. Here’s my code. It gives a “Ran out of memory error” on the line with the MailMerge. I appreciate any help you can give me.


<%@ LANGUAGE=“JSCRIPT” %>
<%
function mailMerge(oldDoc, data, newDoc){
var Rs = Server.CreateObject(“ADODB.Recordset”);
Rs.Open(“SELECT * FROM “+data,
“Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=‘text’;Data Source=”+Server.MapPath(”.”));

var Word = Server.CreateObject(“Aspose.Word.Word”);
var Doc = Word.Open(oldDoc);
Doc.MailMerge.ExecuteADO(Rs);

var Stream = Server.CreateObject(“System.IO.MemoryStream”);
Docnew.Save_4(Stream, 0);
Response.Clear();

Word = null;
Doc = null;
Rs = null;
Docnew = null;

Response.ContentType = “application/msword”;
Response.AddHeader(“content-disposition”,“attachment; filename=”+newDoc);

bytes = Stream.ToArray();
Response.BinaryWrite(bytes);
Response.End();
Stream = null;
}

mailMerge(Server.MapPath(".")+"/dummy.doc",
“dummy.txt”, “output.doc”);
%>



#2
RedSoxFan wrote:
Hi I'm using classic ASP to try to generate a MailMerge with a text file. In the last version this worked fine, but I updated because I wasn't sure if I needed the new version to use the overloaded Save_4 function. Here's my code. It gives a "Ran out of memory error" on the line with the MailMerge. I appreciate any help you can give me.



<%@ LANGUAGE="JSCRIPT" %>
<%
function mailMerge(oldDoc, data, newDoc){
var Rs = Server.CreateObject("ADODB.Recordset");
Rs.Open("SELECT * FROM "+data,
"Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties='text';Data Source="+Server.MapPath("."));

var Word = Server.CreateObject("Aspose.Word.Word");
var Doc = Word.Open(oldDoc);
Doc.MailMerge.ExecuteADO(Rs);

var Stream = Server.CreateObject("System.IO.MemoryStream");
Doc.Save_4(Stream, 0);
Response.Clear();

Word = null;
Doc = null;
Rs = null;

Response.ContentType = "application/msword";
Response.AddHeader("content-disposition","attachment; filename="+newDoc);

bytes = Stream.ToArray();
Response.BinaryWrite(bytes);
Response.End();
Stream = null;
}

mailMerge(Server.MapPath(".")+"/dummy.doc",
"dummy.txt", "output.doc");
%>




Sorry I looked at my code and found that wrong. I had copied it wrong. It still gives that error though.

#3

Hi,

Please specify does the error occur when calling the mailMerge function or namely the Doc.MailMerge.ExecuteADO method?

Could you also specify error number shown at the error page (e.g. "ASP 0177 (0x8007000E)")?

Which version of the operating system and browser are you using?


#4

Ah I found the error. It turns out that I had the .NET Framework 1.1 and 2.0 installed on the computer at once and I guess that generated an error. So I just went back to 1.1 and seems to work fine. Thanks for your help.