For either Libreoffice or Word, how do I insert this kind of field? - ms-word

I am writing a play, and I want to be able to insert two fields, much like Page #. Let me explain...
Each time Scene 1, Scene 2, Scene 3, etc., I want the pages in that particular field to be named after it. So, Scene 2 would be 15 pages, and it would have a 2 on each of those pages. Then on Scene 3, it would have 20 pages, and I want each of those pages with a 3.
Also, I want to do this for Act I and II. For each page in Act I, I want the roman numeral I. For each page in Act II, I want the Roman numeral II.
I was wondering if there is a particular kind of code I can use in either Libreoffice or Word? For example, when "Scene 2" is detected by the software, it writes "2" on that pages and continues to repeat on each proceeding page, until it detects "Scene 3" and inserts 3, instead of 2, on the proceeding pages. I want do the same thing for Act I and Act II.
So basically, I want to insert fields for both of these. Thanks.

Related

iText7 How do I know Table flows to next page like ITextshap Column.HasMoretext?

I have a form where I have to place some fixed data on top and bottom with a variable table in between. If table does not fit on first page, there should be created more pages as needed to acomodate Table.
But for page 2, 3, 4... I still have to print top & bottom, but this time a short version of whats was placed on page 1.
In ItextSharp5 with ColumnText.HasMoreText = true, I know when a new page is needed and can make a new page with proper top & bottom data before drop remaining table.
So how can I achieve same behaviour with iText7?
I did not found a way to know when a table needs some more room
After some reading, found a starting point at Chapter 2: Adding content to a Canvas or a Document
on 3th block of code.

Two different page numbers, first set without the first page number

I can't seem to get how to do this, I need two sets of page numbers, the first set starts from i, ii, iii etc. The second set starts from 1, 2, 3, etc. For the first set, page i should not show the i, but page 1 should show the page number. If I removed the page i number, then page 1 also vanishes, anyone know how to handle this?

GWT manipulating DOM elements caveats

Following this question I have recently asked : Understanding Document.createElement()
Here is the context :
There is a text-zone in my GWT GUI that holds a text
Users can select a word (or a sequence of words) in this text-zone and transform it / them into a highlighted text
highlighted texts need to be able to listen to users : click, right-click, dragging & dropping operations
A scenario with 1000 highlighted text in the text-zone is not impossible.
I was wondering :
Is it a bad approach to manipulate DOM elements directly in GWT ? (Without using Widgets)
Is it a bad approach to do things like that Add listener to SpanElement ? Can it cause memory leaks ?
What is the best approach to achieve such things ? I've done some tests with a simple custom widget that uses a span element, and adding 1000 widgets to the RootPanel takes approximatively 6 to 10 seconds in DevMode. When I use DOM elements direclty, this operation duration goes under 1 second (even less than 200ms with optimizations).
EDIT
Performance should not be a problem, according to some real tests I did after #Gilberto advices. http://jmichelgarciagwt.appspot.com/DOMTesting.html
Still, I would love to have feedbacks for questions 1) and 2)
Adding listeners/handlers to hundreds of span elements/widgets is definitely a bad approach.
If you stay with GWT, you can attach a single event handler to your "text zone" widget, and then find which element has been the source of the click:
http://comments.gmane.org/gmane.org.google.gwt/61911
If you go with DOM elements, you can attach a single event listener to your "text zone" element and find out the event source when it bubbles to it. For example:
http://icant.co.uk/sandbox/eventdelegation/

Objective C - Create Multiple TextFields for the User, then randomly select one and output the Entered Data

Basically what I am trying to do is:
1) The user sets the number of choices he wants e.g. 3 choices which are "A", "B", "C"
[Done this]
2) The next view is loaded and the right amount of boxes are created, 3 in this case. The boxes need to be blank at first and then the user enters their choices into the boxes.
e.g. "A", "B", "C"
Note: I tried create multiple text boxes automatically, but I found that after about 6 boxes the screen wouldn't scroll and therefore looked very tacky
3)At a click of a button, one of the textboxes is selected randomly. The inputed data from this randomly selected box is then displayed in NSLog or Label or file, which i will then use in another view.
Thanks
Dan
Hey, you could make a scrollView out of the 2th view. That way, you can still automatically create textfields, and the screen will scroll. Check out this link for more information on how to create a scrollview. Perhaps you can make the scrollview's size dynamically (depending on how much textfields you have).
About selecting a random textfield, use arc4random() More about that can be found here.

iTextSharp: Is there a way to override hard page numbers in a PDF?

I have a document with a cover page, a table of contents, and then the actual content. The first page after the table of contents is numbered "1" in the footer.
Say the document has 130 pages, 128 pages of actual content aside from the cover and TOC. I want my audience to be able to go to the top of the adobe reader and see 1/128 rather than 1/130. When they enter 1, or 2 etc in that box, it jumps to page 1 or two of the actual content (rather than the cover page or the TOC). Is this possible?
You might get the results you're after with "Page Labels".
PdfPageLabels labels = new PdfPageLabels();
// label the first two pages "i" and "ii"
labels.addPageLabel( 1, PdfPageLabels.LOWERCASE_ROMAN_NUMERALS );
// label the following pages "1, 2, ..."
labels.addPageLabel( 3, PdfPageLabels.DECIMAL_ARABIC_NUMERALS );
myPdfWriter.setPageLabels( labels );
You can also give each page a unique string rather than page numbers:
labels.addPageLabel( pageNum, PdfPageLabels.EMPTY, pageNameStr );
I see "Page 1" in the text entry field, with (1 of 3) in the gray text next to it. I don't think you can change the "of N", just that first part.
Warning: I just discovered that the page "number" dialog in Acrobat X is limited to 8 characters. Any label longer than that is impossible to enter.