Wrap Text in openPD - openpdf

Is there a way to wrap text around an image in openPDF? or around other text? I'm trying to mesh two texts onto one page (texts which may contain pictures), but one text may be larger or smaller then the other. They could look like one of these two pictures:
I was going to make a column text, and test the length of text 2 against the length of the text of text 1 that remains after the first few lines (see the picture), but I couldn't return the remaining text with columnText.go(true).
Is there an easy way to wrap text around a picture or other variable object (aka text)?

Related

How to re-size a text area depending of the text size?

I wanna know an ideal way to re-size a text area depending of the text size like various programs do.
In my case we will asume the width, font and font size are constant, and I'm not using line breaks, so it would be something like doing this:
I know I should consider the words, their length, every " " character, and how many are per line, I wanna know a not messy way to achieve this

Find and replace text with capitalized text in Excel spreadsheet

I've been tasked with reformatting a number of records in a spreadsheet to conform to a unified standard. We have a column containing a large amount of text, along with HTML tags, but I only need to target the tags. Our src paths merely need to be capitalized, but not the entire path. However, the paths all follow this general format.
(something)/custom_design/directory/(more directories)/imageName.jpg
I only need to capitalize /custom_design/directory/(more directories)/. I'll remove the (something) at the beginning of the src path later. Due to the enormous size of this file and the lack of a unified file structure (some image paths use img, others use images, etc.), it would be extremely time-consuming to go through each and every cell in that column and manually change the paths. Is there a faster approach to capitalizing these file paths? Find and replace only goes so far when you don't know the specific directories.
I should mention that the reason I want to target these specific strings, rather than the entire cell's contents, is because these cells are filled with a lot of other descriptive text that shouldn't be completely capitalized.
This is a partial solution for excel. You can use the logic this equation is using to Substitute text by finding their location as determined by back slashes in text (/). The equation is combination of Substitute, Left, Right, and Find.
When your original string is in A1.....
B1 = SUBSTITUTE(A1,RIGHT(LEFT(A1,FIND("/",A1,FIND("/",A1)+1)-1),FIND("/",A1)),UPPER(RIGHT(LEFT(A1,FIND("/",A1,FIND("/",A1)+1)-1),FIND("/",A1))))
I moved the cells over from A:B to G:H to limit size of photo. You can deconstruct this logic to isolate the strings you want. It's not pretty, but this is the only way I personally know how to do this in Excel.

How can I replace specific text inside an excel cell with text from a different column

I have a very large spreadsheet where I need to replace a word in one column with text from another on a large scale.
I need to replace one word (in this case it is [Rate]) with information from a different column.
ex: Fixed rate of [Rate] per kilowatt hour.
finished product: Fixed rate of 0.0652 (number found in different column) per kilowatt hour.
Is this possible on a large scale? There is 800 something of these that I need to update but my work application is rather slow and if I can streamline this it will save me hours of time.
Use the substitute function:
The information page is found at:
Syntax
SUBSTITUTE(text,old_text_or_reference,new_text_or_reference,inst)
Text:the text (as string) or reference in which you want to replace
Old_text:Text to be replaced in the string
New_text:Is the text or reference you want to replace old_text with.
inst: Not a compulsory variable. Is which consecutive number of the occurrence of the old_text that you want to replace.
http://office.microsoft.com/en-nz/excel-help/substitute-function-HP010062578.aspx

svg concatenate text of different styles

I am using d3 to create an axis label inside an svg element. Part of the label is constant (string literal) and part of it varies as the user clicks around. To emphasize that it changes, I want it to be bold, while the rest of the text is normal weight. Aligning these two text elements, to each other and the rest of the drawing, has turned out to be quite difficult.
Also, it seems trailing spaces in text elements are ignored, making it harder to do the concatenation. And if there's a way to change styles within a text element, that would work too.
Here is a very hacky way of doing it, in that it won't work with three pieces of text (because text-anchor), and the result is hard to center (do I really need to go use getBBox()?).
function renderLabel(dynamicText){
svg.select(".label").remove();
var label = svg.append("g")
.attr("class", "label")
label.append("text")
.attr("text-anchor", "end")
.text("The Axis is Based On ");
label.append("text")
.attr("text-anchor", "start")
.style("font-weight", "bold")
.attr("transform", "translate(6,0)") //space
.text(dynamicText);
}
In general, I would like to be able to append/concatenate any number of string variables, each with distinct styles, in a way that "looks good" as a sentence, and can be centered. Please tell me there's a better way to do it.
Instead of using separate text elements, use one text element with two tspan elements nested inside. If you do not set separate positioning attributes on the tspan, they will naturally line up as one row of text.
https://developer.mozilla.org/en-US/docs/Web/SVG/Element/tspan

How to tell if ultragrid text has been truncated

We are using infragistics ultragrid to present data to the user. if the user modifies the width of a column, I need to be able to tell if the data is truncated so that I can adjust the output properly when exporting the data into pdf. We want to truncate the data when exporting to other formats to match what the user sees after the column width adjustment.
Thanks,
Currie
Whether the text is cut off or not is done automatically when drawing the string so you would need to get the available space and the string and then determine how much of it fits into the space when drawn.
Within the CellExporting event of the UltraDocumentExporter, you can get the text and the size with the following:
Size size = e.GridRow.GetCellSizeResolved(e.GridColumn);
string text = e.GridRow.GetCellText(e.GridColumn);
You can also change the value that is being exported by setting e.ExportValue to the string that you want to put in the PDF document.
What remains to be done is to determine the amount of characters that fit into the rectangle and the following should help you with that:
How to determine maximum number of characters given a fixed width font and a maximum width in pixels

Resources