I tried to save a Snippet to a TMemoryStream in the hope, I could insert the stream on the current topic. The stream is in binary form - I saw it, as I write the stream to my hard disk. Here is a code stripe of my code base for HelpNDoc Pascal-Engine.
The parameter "content" stands for the Current HTML Topic text:
function getCustomHintBoxCode(content: String): String;
var _idx: Integer;
var _txt: String ;
var _tmp: String ;
var _str: String ;
var _arr: THndLibraryItemsInfoArray;
var _inf: THndLibraryItemsInfo;
const _hintbox = 'hintbox';
const _snippet = 'snippet';
begin
_arr := HndLibraryItems.GetItemList([7]); // 7 = Snippets
_str := content;
for _idx := 0 to Length(_arr) - 1 do
begin
_inf := _arr[ _idx ];
_tmp := Trim( Copy(_inf.Caption,Length(_snippet)+2,64));
if (LowerCase(Copy(_inf.Caption,1,7)) = _snippet) then
begin
HndLibraryItems.GetItemContent(_inf.id).SaveToFile('E:\out.tmp');
showmessage('0: ' + _tmp);
end;
end;
result := _str;
end;
Is there a way, to save the stream directly to the current position of the existing topic ? Or: can the stream be saved a HTML or Text ?