Is it possible to remove the numbering on hidden text/sections in libreoffice writer?
For instance, I have a document that hides several sections depending on a user defined variable (which is used to define the document type) that looks like this:
(1) Section A
(2) Section B
(3) Section C
I want to hide Section B so it looks like this:
(1) Section A
(2) Section C
Instead of:
(1) Section A
(3) Section C
Is it possible?
If there are not too many sections, then it may work to use conditional text fields to show the appropriate number. This would work based on that same user defined variable that you used to show or hide sections.
So in your example where it says (3) Section C, remove 3 and instead insert a conditional text field. To do this, go to Insert -> Fields -> More Fields, and select the Functions tab. Type should be "Conditional text". In the Condition box, enter the same expression that you used to hide section B. In the Then box enter 2, and in the Else box enter 3.
Now press Insert to insert the field. It should now say (2) Section C if section B is hidden, or (3) Section C if it is not.
See also http://www.openoffice.org/documentation/manuals/userguide3/0214WG3-WorkingWithFields.pdf.
If you need something a little more complex (but still without too many sections), this idea can be expanded. For example:
(1) Section A
(2) Section B
(3) Section C
(4) Section D
Let's say that depending on the document type, either section B, section C, or both B and C may be hidden. Then the numbering for section D will need several conditional text fields. Set the first field condition to an expression like (MyDocType EQ "HideB") OR (MyDocType EQ "HideC") and the Then value to 3. Leave the Else blank, in which case it won't show up at all when printed.
Insert another field for section D with condition MyDocType EQ "HideB_and_C" and the Then value to 2. Add a third field for section D with condition MyDocType EQ "ShowAll" and the Then value to 4. It should now show the appropriate number for Section D.
For a lot of sections or more document types, it would probably be better to write a macro.
Related
I have a table like this one :
This table represents a species (No = 3) and the number of individual for the last 6 years. (FYI, the table cannot be displayed differently.)
I created a Combo Box which displays the last 6 years (based on a field list).
What I have to do so that the turquoise rectangular automatically displays "31", for example, if the year "2014" is selected?
The question doesn't contain enough detail about the host form and other bound controls, so the following is just a pattern to follow.
Set the Control Source of the turquoise (i.e. cyan) control to something like
= DLookup("[" & comboboxYear.Value & "]", "TableName", "ELEMENT_ID=" & [ELEMENT_ID])
This assumes that there is a bound control named [ELEMENT_ID] on the form. Brackets wrap the ComboBox value to ensure the value is interpreted as a column name and not a number.
How do I get a smart numbering system as shown below? Whenever I have a new table, I want the numbering to rise.
If, on the other hand, I add a row to the table, I would like to add a letter in behind the numbering.
Is this possible?
I have startet using Field Codes and Sequences, and I believe it is the way to go.
I know the numbering without the letters can be obtained by
Number #{ STYLEREF 1\s}{SEQ Table \# "00"}
I also know that alphabetic numbering can be made by using the \alphabetic command.
I am just not sure how to combine them. Also, I would like to make cross-references to the table captions.
You can achieve this with Word's built-in numbering - no need to resort to a complex combination of fields that you'll need to manually update.
I'm going to outline the very complete approach...
On the Home tab: Paragraph/Multilevel list/Define new list style.
Enter a name for the style, then from the Format button choose Numbering; click More.
With Level 1 selected, choose the style with which you want to link the numbering (Heading 1, for example)
In the "Enter formatting for number" field type any text you want to have appear before or after every number. (According to your picture: Header in front of the number 1 with grey shading already in the box.)
Select Level 2, choose the style with which you want to link the numbering (Heading 2, for example)
In the "Enter formatting for number" field type in front of the number (2, grey shading): Number #00
From the "Include level number from" dropdown, select level 1. The number from Level 1 will be inserted between the last 0 and the grey-shaded 2.
If necessary, change the alignment settings (you probably don't want the indent inside the table cell?)
Now, when you apply the Heading styles the numbering will be applied automatically. If you don't like the formatting of the Heading styles you can change the style definition(s). Since you created a numbering style, you can also change these settings by going again to the Multilevel numbering dialog box, right-clicking the numbering format you created and selecting "Modify".
I believe the following field code approach will give you the numbering indicated in your sample image (where the table numbering restarts for each Heading 1 paragraph. However, it will probably only work for "in-line" tables, not floating tables or tables in text boxes and so on.
The main aim here is to ensure can insert exactly the same field codes for each new "Number#" that you need, but to achieve that you also have to put some codes at the beginning and end of each table. You will also need to select and re-execute all the field codes twice to ensure that they are updated properly - this is the kind of disadvantage that Cindy Meister's Answer mentions.
At or before the beginning of each table, put the following fields. (If you are already putting a table caption before each table, you could do this slightly differently.)
{ SEQ tbl \s 1 \h }{ SEQ ltr \r0 \h }
This increments the table number, resetting at each Heading 1 paragraph, and resets the letter number to 0.
For every "Number #" you want in a table, use the following fields:
Number #{ STYLEREF 1 \s }{ SEQ tbl \c #00 }{ SEQ ltr \h }{ IF { REF "chap{ STYLEREF 1 \s }tbl{ SEQ tbl \c }" } > 1 "{ SEQ ltr \c \*alphabetic }" "" }
This inserts the appropriate Heading number and the table number, and increments the letter number. It then looks at a bookmark that contains the number of "Number #" entries in this table. For example, if Heading 1 is numbered 4, and this is the thrid table under that heading, the bookmark will be called "chap1tbl4". If the bookmark's value is greater than 1, the appropriate letter will be appended.
But we have to create that bookmark and value, which we can only do after all the "Number #" fields for that table. So at the end of each table, or immediately after the table and before any new Heading 1 paragraph, you will need the following field codes:
{ SET "chap{ STYLEREF 1 \s }tbl{ SEQ tbl \c }" { SEQ ltr \c } }
The thing is that Word evaluates field codes in the sequence they appear in the document. So when Word first encounters the { REF } field in the table, the bookmark will have no value. So the first time you select all the fields and execute them, you may see the wrong answer. After you have done that, the bookmark is created. Word will use the value most recently assigned to the bookmark, so the next time you execute the "Number #" fields, they should work properly.
I think to achieve what you wanted using the general approach given in Cindy Meister's Answer, you would need to have two separate Heading levels, one for the Numbers without letters,and another for the numbers with letters. The user, or some VBA (say) would then have to decide for each table which Heading level to use. But even if that is the case (and she may have something else in mind), it may still be an operationally simpler approach than the field-based one. I suspect only you are in a position to decide.
There may be a simpler field-based formulation, but IME the basic problem is that you cannot test the "final value" of a SEQ or SET field, only the value it has at the point of execution. For example, if there was a \f flag that let you test the final value of a SEQ field, you could use
{ IF { SEQ "chap{ STYLEREF 1 \s }tbl{ SEQ tbl \c }" \f } > 1 .... }
to test the number of "Number #" entries in each table, without having to have that awkward end-of-table SET field.
I am using a 3 way formula to put notes below the group footer of my Crystal Report. Please see below example for illustration
1. Text
a. Text
b. Text
2. Text
a. Text
b. Text
3. Text
a. Text
b. Text
c. Text
I was able to put the numerical series using a variable and increment it by 1, however in letters, I have seen a code to something like
chrw(96 + i) //where i is 1 based
But that wont work because my text interpretation is on HTML, are there alternatives? or conversion of the code for it to take effect in my formula.
chrw(ascw("`") + (var2 := var2+1))
the code above worked for me!, just set the variable var2 and initialize to 0 value. Do some conditioning to create an indention effect.
I need to add .jpg at the end of all he cells in one or more columns
9788895249971 into > 9788895249971.jpg
9788867230129 into > 9788867230129.jpg
9788867230273 into > 9788867230273.jpg
9788867230280 into > 9788867230280.jpg
Detailed step-by-step instructions are much appreciated since I am very new to Calc.
Thanks
Do you need to do this once or is this going to be a repeated task every week/month?
If it is something you need to do just once, here is what you can do:
Next (right) to the column where your numbers are open (insert) a new column.
Assuming the following: Numbers are in column A, New column is column B.
In this new column B in the top cell (B1) write:
=A1&".jpg"
Now copy B1 all the way down to the end. In B1 type [Ctrl]+c then Hold [Shift] and hit [PgDn] until the end then press [Ctrl]+v.
Highlight Column B, [Ctrl]+c, then [Edit] [Paste Special] values only (No formula's) this freezes the calculated data.
This is just another option,
just click the function wizard and select concatenate, in that enter which column you want to enter as text1 as and second column in text2. Then when you click OK you will get an concatenated column like below image
so in the C column you will get as a1.jpg.
For those who continue to find this question (as I did):
This can be quickly done using regular expression option of find and replace. (I don't know what version of Calc introduced regex searches, but 6.2.4 has it.)
If you only want to update some non-blank cells on the sheet, select them.
Choose Find and Replace.
On the dialog, fill in the following:
Enter $ for the Find value. ($ means end of line in regex, or in this context end of cell value.)
Enter the desired suffix (.jpg in the question) for the Replace value.
Check Regular Expressions under Other Options
Check Current Selection Only under Other Options if you want to limit to the cells selected in step 1.
Uncheck All Sheets unless that is what you want.
Choose Replace All
This will update the values in-place and does not require any additional columns or formulas.
There's a much more elegant way to do this that doesn't require sacrificing cells just to hold data types, and can be scaled to work with one cell or a large chart range.
Add both pieces of data into the =CONCAT() function
Make sure to use CONCAT instead of CONCATENATE, as `CONCAT accepts cell ranges and is more dynamic.
Open the Function Wizard on the cell in question, and build the following function:
=CONCAT(<your_data>," <suffix>",...)
# Make sure to add a space before the suffix so it appears in the cell.
# You can use this with as many input variables as required letting
# you add as many strings, formulas, or numbers together.
The result should be something like this. In my example, the cell in question is the final value of Ethereum on a balance sheet:
The above example was an easy one, since it was being used as a test, all my summed values were ints, if I had floating point numbers, they would run away to max decimal places (not very pretty).
The function will drag out and expand intelligently to other cells like any other formula.
Adjusting accuracy of floating point values inside a CONCAT function
Sometimes, adding a cell results in a rounding problem, or an extreme amount of decimal places. You can further nest your function using ROUND(<your_data>,<decimal_places>)
Your function would look like this:
=CONCAT(ROUND(<cell_range>, ".jpg")
In your specific case, you don't need a space in the second argument as you want to append .jpg directly to the end of the string.
`
Using Macros to automate the entire process
This is extremely repeatable, and using the Macros feature, you can automate these to make much more simplified functions that allow you to enter just the variables you need, while the macro does the work in the background.
Based on Emmanuel Angelo R.’s answer, I would advice learning to differentiate between fixed cell references and dynamic ones. The following applies:
Cell A1 contains the suffix you would like to add, e.g. ‘.jpg’
Row 2 contains headings, e.g. B2 = ‘Old Filename’ and ‘New Filename’
Cells A3:A¹ contain your filenames
Cells B3:B contain you concatenation formula
In cell B3, type =concatenate(A3;$a$1).² If your locale requires comma as separator, replace my semicolons with commas. Copy cell B3 by selecting it and pressing Ctrl + C. Move the cursor to cell A3, press Ctrl + ↓ (down arror on your cursor keys); this will move you to the bottom of the list of file names. Move your cursor right, then press Ctrl + Shift + ↑; this will select all cells up to the last cell with contents (the one you just wrote your formula in). Press Ctrl + V to paste your contents.
Adding dollar signs in front of your row/column coordinates, will lock that coordinate when pasted. Say you had a list of file types in cells b1–z1 (e.g. jpg, jpeg, tga, bmp, png et c.). An easy way to create the formula would then be by first typing it in cell B3 as =concatenate(A3;B$1), then paste it to every cell till the end of your file names list (cell z3); these cells would then read …A3;b$1, …A3;C$1 et c. When copying it for all the rows below
You could select the entire range of cells with formulas in row 3 and run a search and replace, replacing all instances of ‘A3;’ by ‘A3;$’, effectively inserting a dollar in front of all the cell references, allowing you to, should the need arise, copy it horizontally as well as vertically (the latter being covered by the $ in front of 1).
¹ This means cells from A3 and however far down your sheet goes
² Strictly speaking, it is only necessary to type it as a$1.
I am building a subreport and have two tables from which I am using one field each containing a phone number.
Original Number {TABLE1.ORG}
Temporary Number {TABLE2.TEM}
What I want:
If {TABLE2.TEM} is not null, then hide {TABLE1.ORG}, else show {TABLE1.ORG}
I tried to use the above as a formula but it doesn't work too Since these both fields are from two different tables if place them next to each other (without any formulas or suppression) in the design mode:
{TABLE1.ORG} {TABLE2.TEM}
...I see them on different lines in preview mode:
+971 4 321321321
+971 4 123123123
Maybe because the formula reads records and evaluate from the same line, I guess this is the reason why above is not working correctly.
It's not obvious why the two fields are appearing on different lines in preview mode, but it's unlikely to be because they are from different tables - it's more likely to be because there isn't enough room in the layout for them both to display in one line, and so they are growing to a size that canb be displayed.
To conditionally suppress {TABLE1.ORG} based on whether the other field is not null:
right-click on {TABLE1.ORG} and select Format Field...
in the Common tab within the Format Editor dialog, click on the conditional suppress formula button x-2 and enter the formula not IsNull ({TABLE2.TEM}) in the Format Formula Editor.
click Save and close to exit from the Format Formula Editor, then click OK to exit the Format Editor dialog.
If you now preview the report, you should find that {TABLE1.ORG} is suppressed where {TABLE2.TEM} is not null.
Note that if you make display of both fields conditional on whether the other is null, then both will be suppressed where neither is null.