Jump to content

Progamatically load a HTML MS Word document into UniDBHTMLMemo


mbierly

Recommended Posts

I used the forum topic as the start of what I'm doing

Here's my code in the UniFileUploadCompleted event:
 

  var DestFolder: string := UniServerModule.StartPath + 'UploadFolder\';
  var DestName: string := DestFolder + ExtractFileName(UniFileUpload1.FileName);
  CopyFile(PChar(AStream.FileName), PChar(DestName), False);

  var AFile: TFile;
  var AHtml: string := AFile.ReadAllText(DestName);

  ACmd := '.execCmd(' + '''' + 'InsertHTML' + '''' + ' , ' + '''' + AHtml + '''' + ')';
  UniSession.AddJS(UniDBHTMLMemo1.JSName + ACmd);

I'm getting an Unterminated String Constant error that I haven't been able to figure out. Any ideas what I need to change?  

There is additional code I've got that makes changes to the AHtml variable.  I don't believe that is the source of my problem because I have inspected the variable in debug, copied the contents and then switched the DBHTMLMemo into source edit mode on the toolbar, pasted in the modified HTML and toggled back to "regular" mode everything displays as expected. 

Link to comment
Share on other sites

23 minutes ago, mbierly said:

I'm getting an Unterminated String Constant error that I haven't been able to figure out. Any ideas what I need to change?  

Hello,

Can you make a simple testcase for this (maybe with UniHTMLMemo)?!

Link to comment
Share on other sites

55 minutes ago, mbierly said:

Here is the test case to get the Unterminated String Constant error.  I've included the MS Word doc in HTML format that I've been trying to get to load. It's located in the project folder.

Try this

1. Uses list:

uses
    uniGUIVars
  , MainModule
  , uniGUIApplication
  , System.IOUtils
  , System.StrUtils
  , ServerModule
  , ExtPascalUtils //<-----------
  ;

2. 

...
  ACmd := '.execCmd(' + '''' + 'InsertHTML' + '''' + ' , ' +  StrToJS(AHtml) + ')'; //<-----------

  UniSession.AddJS(UniHTMLMemo1.JSName + ACmd);
end;

 

  • Like 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...