I can set height for row. But it is fixed height. if content increases height does not increase automatically. just clip extra content.
Here is my code. how can i set default height 20 not fixed height
pdf.table([applicant_data],
:cell_style => {
:inline_format => true,
:padding => [3, 3,3,3], :size => 9,
:border_widths => [0.5, 0.5, 0.5, 0.5],
:height => 20,
#:font_style => :bold
},
:column_widths => {0 => 30, 1 => 110, 2 => 50, 3 => 110, 4 => col_wid_bo })
In the table block, you can set the row height:
pdf.table data do
rows(0..-1).each do |r|
r.height = 25 if r.height < 25
end
end
I solved the problem by setting height dynamically based on string length. If string fits in one line the default height , if not not increase height based on string length. That's it.
Related
As a source file I have a square image (500x500).
As soon as I use the cropArea, the preview shows that the entire area has been selected (500x500px)
'cropVariants' => [
'default' => [
'title' => 'LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.crop_variant.default',
'allowedAspectRatios' => [
'1:1' => [
'title' => 'LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.1_1',
'value' => 1.0
]
],
'selectedRatio' => '1:1',
'cropArea' => [
'x' => 0.0,
'y' => 0.0,
'width' => 1.0,
'height' => 1.0,
],
],
],
But in the database, however, the following data (sys_file_reference) is stored: (problem y-coordinate)
{"default":{"cropArea":{"height":1,"width":1,"x":0,"y":-0.002},"selectedRatio":"1:1","focusArea":null}}
In Fluid this is my code:
<f:image src="{item.image.0.reference.uid}" alt="{item.image.0.reference.description}" treatIdAsReference="1" />
As a result that image is rendered in fluid with 500 x 499 pixels. (1px is missing)
Any idea how I can adjust the behavior? so that the y-coordinate is also set to 0 and the whole selection is rendered?
I am working on a web app in ruby on rails that should list presentations that a set of users can sign up for. At the end, the admin should be able to send an email to all users with an automatically generated PDF. I am using prawn to create this pdf.
The controller:
def generate_pdf(teac,pres)
Prawn::Document.new(:page_size => "A4", :page_layout => :landscape) do
text "#{teac.name} #{teac.surname}", align: :center
text "Your Presentations"
table([
["Name","Surname","Title","Room","Time","Date"],
[pres.collect{ |r| [r.name] },
pres.collect{ |r| [r.surname] },
pres.collect{ |r| [r.title] },
pres.collect{ |r| [r.room] },
pres.collect{ |r| [Time.at(r.time.to_i).utc.strftime("%H:%M")] },
pres.collect{ |r| [r.date] }]
])
move_down 20
pres.each do |pres|
text "visitors '#{pres.title}':"
text "#{pres.visitors}"
move_down 20
end
end.render
end
The problem occurs when the title is so long that the table expands beyond the landscape A4 page. Is there a way to automatically add a new line when the title becomes to long?
If you are okay with setting static column widths, that should to the trick.
For example:
table(data, column_widths: [100, 100, 100, 100, 100, 100])
I'm trying to validate the existence of a UIButton that is initially disabled continueButton.isEnabled = false.
When I check the tree in calabash-ios console I get the following result
[UIWindow]
[UIView]
[UIView]
[MyProject.GradientView]
[UIImageView] [id:logo-1] [label:Logo 1]
[UIImageView] [id:logo-2] [label:Logo 2]
[MyProject.UnderlinedTextField] [label:Email] [text:]
[UITextFieldLabel] [label:EMAIL] [text:EMAIL]
[UIAccessibilityTextFieldElement] [label:Email] [text:EMAIL]
[UIButton] [label:Let's go]
[UIButtonLabel] [label:LET'S GO] [text:LET'S GO]
true
However, when I try to use query("button") I get an empty array. If the button is enabled and use query again the result is:
[
[0] {
"id" => nil,
"description" => "<UIButton: 0x7fcdc8f1b6b0; frame = (23 571; 329 63); clipsToBounds = YES; opaque = NO; layer = <CALayer: 0x608000228b20>>",
"label" => "Let's go",
"frame" => {
"y" => 571,
"x" => 23,
"width" => 329,
"height" => 63
},
"accessibilityElement" => true,
"value" => nil,
"alpha" => 1,
"enabled" => true,
"visible" => 1,
"selected" => false,
"class" => "UIButton",
"rect" => {
"y" => 571,
"center_x" => 187.5,
"center_y" => 602.5,
"x" => 23,
"width" => 329,
"height" => 63
}
}
]
Why a disabled button is not listed when using query? Is there any way to validate if a button exists regardless of its enable state?
UPDATE
When using query ("all button") as suggested by jmoody I'm able to get the button listed.
[
[0] {
"id" => nil,
"description" => "<UIButton: 0x7fe05ad18000; frame = (23 571; 329 63); clipsToBounds = YES; opaque = NO; layer = <CALayer: 0x60000022d940>>",
"label" => "Lets go",
"frame" => {
"y" => 571,
"x" => 23,
"width" => 329,
"height" => 63
},
"accessibilityElement" => true,
"value" => nil,
"alpha" => 1,
"enabled" => false,
"visible" => 0,
"selected" => false,
"class" => "UIButton",
"rect" => {
"y" => 571,
"center_x" => 187.5,
"center_y" => 602.5,
"x" => 23,
"width" => 329,
"height" => 63
}
}
]
When the button is disabled, is it physically visible?
# All buttons regardless of visibility.
query("all button")
# Ask every button if is enabled.
query("all button", :isEnabled)
# Filter buttons by disabled
query("all button isEnabled:0")
Why a disabled button is not listed when using query?
Calabash uses a visibility heuristic to determine if a view is visible.
At first glance, it does not look like Calabash asks anything about whether a UIControl is enabled or disabled to determine if a view is visible.
I have the same issue, but I can suggest a workaround:
specify different accessibilityIdentifier for the button when it's hidden or visible, something like my_super_button_hidden, when it's hidden and my_super_button_visible otherwise
always use all keyword in your button query
examine visibility by checking accessibilityIdentifier
examine enabled state as you did before
checked on ruby 2.4.0, run_loop 2.3.1
I have a label on iOS app that I'm not able to touch
irb(main):022:0> label "label"
[
[0] "Create account",
[1] "Log in",
[2] "com.blabla - v505"
]
I want to click the last element that basically is this
irb(main):014:0> query("view {accessibilityLabel LIKE 'com.blabla*'}")
[
[0] {
"class" => "UILabel",
"id" => nil,
"rect" => {
"center_x" => 160,
"y" => 519,
"width" => 280,
"x" => 20,
"center_y" => 540.5,
"height" => 43
},
"frame" => {
"y" => 519,
"width" => 280,
"x" => 20,
"height" => 43
},
"label" => "com.blabla - v505",
"description" => "<UILabel: 0x7a1ebac0; frame = (20 519; 280 43); text = 'com.blabla.enterprise.cal....'; clipsToBounds = YES; opaque = NO; autoresize = W+TM; gestureRecognizers = <NSArray: 0x7a1e8900>; layer = <_UILabelLayer: 0x7a1ebbe0>>"
}
]
I tried different ways to click that element but all give me the same error
NoMethodError: undefined method `to_sym' for nil:NilClass
I tried the following
. touch("view {accessibilityLabel LIKE 'com.blabla*'}")
. tap_mark label("label")[2]
any idea or suggestion for me to be able to touch that label?
Have you tried tap_mark label ("com.blabla -v505")? Maybe I'm misunderstanding.
I want to specify a font style for a certain cell. What I found in the documentation is the capacity to do it for all the cell, but not for one I need:
table data, :cell_style => { :font => "Times-Roman", :font_style => :italic }
How do I do that for only one cell?
Turn your table into a block to do more configuration and then you can find it by row and column. See line 2 for your font, I included a couple other examples to set styles by rows & columns:
table(invoice_header_data, width: 210) do
style(row(0).column(0), font: "Times-Roman")
style(rows(0..-1), :padding => [2, 10, 2, 10], :borders => [])
style(row(4), padding: [12, 10], :font_style => :bold)
style(columns(1..3), :align => :right)
end