Updating HelpNDoc script to locate library items in help topics - pascalscript

I am trying to write a script to use with HelpNDoc.
I am part way there:
var
aList: THndLibraryItemsInfoArray;
nCnt: Integer;
begin
// Get all items in the library
aList := HndLibraryItems.GetItemList([]);
// Go through each of them
for nCnt := 0 to Length(aList) - 1 do
begin
// Is this a image (1)?
// Is this a image map (9) ?
if(HndLibraryItems.GetItemKind(aList[nCnt].id) = 1 or HndLibraryItems.GetItemKind(aList[nCnt].id) = 9) then
// What is the default alternate text?
var aDefaultAltText := HndLibraryItemsMeta.GetItemMetaStringValue(aList[nCnt].id, 'defaultalttext', '');
// Update the alternate text if required
if(aDefaultAltText = '') then
// Now what do we do? We need to find all instances of where this library item has been used.
// When we encounter one that has an alternate text description we update the meta.
// How?
end;
// What is the default padding?
var aDefaultPadding := HndLibraryItemsMeta.GetItemMetaIntValue(aList[nCnt].id, 'defaultpadding', 0);
// Update padding if required
if(aDefaultPadding = 0) then
HndLibraryItemsMeta.SetItemMetaIntValue(aList[nCnt].id, 'defaultpadding', 5);
end;
end;
end.
I can:
Iterate all library items
Isolate all image / image map items
Extract the default padding / alternate text values.
Update the default padding value to 5 if it is 0.
The issue is with the alternate text. If it does not have a default value then I want to do this:
Iterate all help topics
Iterate all library items used in each help topic
Find if the library item was used in that topic
If it was, it gets alternate text value.
If that value is not empty, apply it to the meta default value. Otherwise find the next instance.
If, by the end of iteration it did not find a alternate text value that was not empty it prints the library item name on screen.

It is not possible to do what I wanted via the API.
Response from HelpNDoc:
HelpNDoc's API doesn't include ways to iterate over topic content.

Related

How to access value from react-native-cn-richtext-editor

I have successfully implemented react-native-cn-richtext-editor with limited toolbar functions.
I want to know that, how to get value (text that we have typed) from editor.
I am new in RN, have tried to get value but didn't get success. How can I resolve this issue, as I want to sent this text to server and then do further process.
In given example of this library there is method onValueChange on change the content object is present in value and to extract the value below example is there
onValueChanged = (value) => {
console.log(value[0].content[0].text)
}
Finally I got the solution of above question.
convert the value in HTML with convertToHtmlString write following command,
let html = convertToHtmlString(this.state.value)
for more details refer this github link

Birt export in pdf does not wordwrap long lines

My reports preview is ok.
But now, I need to export to pdf...and I've got an issue : the content of some cells are truncated to the witdh of the column.
For instance, 1 cell should display "BASELINE"...in the preview it's ok...but in pdf, it displays "BASEL".
I've been looking for a solution the whole day and did not find anything...
Of course : I don't want to fit the width of the column on the length of this word "BASELINE" because the content is dynamic...
Instead, I want to fix the column width and then, the cell should display something like that :
BASEL
INE
Any idea ?
Thanks in advance (am a little bit desperated...)
The solution is trivial in BIRT v4.9 if you've integrated the engine into your java code. Just set the PDF rendering options.
RenderOption options = new PDFRenderOption();
options.setOutputStream(out);
options.setOutputFormat("pdf");
options.setOption(PDFRenderOption.PDF_WORDBREAK, true);
options.setOption(PDFRenderOption.PDF_TEXT_WRAPPING, true);
task.setRenderOption(options);
You have to set a special PDF emitter option:
PDFRenderOption options = new PDFRenderOption();
options.setOption(PDFRenderOption.PDF_HYPHENATION, true);
This is if you integrated BIRT into your Java program.
For the viewer servlet, it is possible to set such options, too, AFAIK, but I don't know how; maybe on the URL or using environment variables.
I had the same issue. I found a very good topic about that : http://developer.actuate.com/community/forum/index.php?/topic/19827-how-do-i-use-word-wrap-in-report-design/?s=173b4ad992e47395e2c8b9070c2d3cce
This will split the string in the given number of character you want :
The function to add in a functions.js (for example). To let you know, I create some folder in my report project : one for the reports, one for the template, one for the libraries, another for the resources, I added this js file in the resources folder.
/**
* Format a long String to be smaller and be entirely showed
*
*#param longStr
* the String to split
*#param width
* the character number that the string should be
*
*#returns the string splited
*/
function wrap(longStr,width){
length = longStr.length;
if(length <= width)
return longStr;
return (longStr.substring(0, width) + "\n" + wrap(longStr.substring(width, length), width));
}
You will have to add this js file in the reports : in the properties -> Resources -> Javascript files
This is working for me.
Note: you can add this function in your data directly if you need only once...
The disadvantage of this : you will have to specify a max length for your character, you can have blank spaces in the column if you specify a number to small to fill the column.
But, this is the best way I found. Let me know if you find something else and if it's working.

Delphi - Form Properties empty on FormCreate when set from other Form

Here is an interesting case.
Have the Login Form, where some variables values are set, like company_id and SelectedlanguageCode, the idea is to pass this values to the MainForm properties to make things fast (selected language code go to Database to query), this values will be immediately required in the FormCreate Event, but here the values are missing, but debugging after the CreateForm-event the values just show.
Here is the Project Source Code:
{$R *.res}
Var
LoginOK: Boolean = False;
sCompanyId: integer;
sSelectedLanguageCode: string;
begin
// The login form is created and show up
// --------------------------------------
fLogin := TfLogin.Create(nil);
try
// Show login form. When it closes, see if login worked.
fLogin.ShowModal;
LoginOK := fLogin.CanLogin;
sCompanyId := fLogin.pCompanyId;
sSelectedLanguageCode := fLogin.gDefaultLanguageCode;
finally
fLogin.DisposeOf;
end;
if not LoginOK then
Halt; // Login failed - terminate application.
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TfMain, fMain);
// Here the properties of Main are set with the values,
// when debugging the properties get the values, you can
// see the actual values when hovering over the property
fMain.gSelectedLanguage := sSelectedLanguageCode;
fMain.gUserCompany := sCompanyId;
Application.Run;
end.
But as mentioned, in the CreateForm of Main, the properties are empty...
And... after CreateForm event, the properties have the actual value.
I need this values in CreateForm event because some methods will be invoked and need to send them...
I appreciate the answer about what is going on to understand what am I doing wrong, or if that have a good reason to be just like that then... if you can give me another approach to solve this requirement, thanks.
OK, so instead of having your initialisation code in the formCreate, move it all to a method on the main form (e.g. init()).
then in the line before you application.run you can have
mainform.init;
or
mainform.init(sSelectedLanguageCode, sCompanyId);
I always split out creation from initialisation. If the form is shown and isn't initialised you can raise an error then. i.e. in the onShow, if no company ID - tell the user there was an error and close the app....

Looping a number count in Edge Animate

I am creating a banner in Adobe Edge Animate with a number count going from 0 to 1000, then slowly going to 1001... 1002... 1003... and then restarting/looping.
I have searched multiple online forums and I am using a code that I found in a previous post that works for the number count (see below), but I cannot get it to loop. Usually when I want to loop a banner I go to a specific time in the timeline and insert a trigger with
this.play (0);
This still loops the banner but not the loop count - it only displays the number 1000 until looping again. Any tips on how to go about this?
Here is link to my banner, when the flashing colors appear is when the banner is looping:
Banner
Here is the code I'm using:
var counter_delay = 0;
var max_count = 1000;
var present_count = 0;
var timer = window.setInterval(stepUp,counter_delay);
function stepUp(){
present_count++;
// Change the text of an element
sym.$("Text").html(present_count);
if(present_count==max_count)
clearInterval(timer);
}
The variables are not working like this. You have to set and get Variables in Edge.
On Composition Ready
sym.setVariable("variablename", 0);
Get Value
var myVariable = sym.getVariable("variablename");
Change Value and Set it again
myVariable++;
sym.setVariable("variablename", myVariable);
For your Loop i think you can use "onupdate" and just use: get variable, increase variable, set the Value for your Variable again.
Then, if your number is high enough, just set the variable to 0 again.

How to change Page Title with Tag Manager in order to show different title in Analytics?

The best solution would be to modify website that is being tracked and change it to generate more valuable Page Titles.
However, that isn't possible and I would like to use breadcrumbs to provide new Page Title for Analytics.
I've created new variable for title in Tag Manager and added a Trigger for it in a Tag.
And yet the Page Title isn't changing and therefore I ended up wondering should this tag be fired before Analytics tag?
EDIT:
I've now used it with Preview mode and I can see that it is at least trying to set a new value for title. However, the value seems a bit too "unescaped" and I think that there's some hidden characters that cause problems.
EDIT 2:
function() {
var a = jQuery('.breadcrumb_container a');
delete a[0];
var textValues = jQuery(a).map(function() {
return jQuery(this).text();
}).get();
var str = textValues.join(' > ');
return str;
}
There is no need to create a new trigger. You should edit your existing pageview tag and set field of title as indicated below: