How to fix the width of any column when creating a table? - java2word

I'm trying to put a 2 columns table in a new MSWord document using java2word but I'm unable to fix the width of the columns.
Here the code:
Table tbl = new Table();
tbl.addTableEle(TableEle.TH, "Descriptions", "");
tbl.setRepeatTableHeaderOnEveryPage();
tbl.addTableEle(TableEle.TD, "Description", "cette case sert à afficher les détails");
tbl.addTableEle(TableEle.TD, "pers appelées", "Marc, Stéphane, Bernard");
tbl.addTableEle(TableEle.TD, "liste", "vide pour l'instant");
tbl.addTableEle(TableEle.TD, "Fonctions", "Chef, administrateur, employé");
tbl.addTableEle(TableEle.TD, "code", "select * from personne");
myDoc.addEle(tbl);
myDoc.addEle(new BreakLine(2));
I would like to set the width of the 1th column to [3 cm], and also make the 1th column unwrappable (doesn't split the row in 2 rows).
Is anybody can help ?

The new code look like this now:
Table tbl = new Table(3.0f, 14.0f); //Sizes of the columns in cm
tbl.addTableEle(TableEle.TH, "Descriptions", "");
tbl.setRepeatTableHeaderOnEveryPage();
tbl.addTableEle(TableEle.TD, "Description", "cette case sert à afficher les détails");
tbl.addTableEle(TableEle.TD, "pers appelées", "Marc, Stéphane, Bernard");
tbl.addTableEle(TableEle.TD, "liste", "vide pour l'instant");
tbl.addTableEle(TableEle.TD, "Fonctions", "Chef, administrateur, employé");
tbl.addTableEle(TableEle.TD, "code", "select * from personne");
myDoc.addEle(tbl);
myDoc.addEle(new BreakLine(2));

Related

why laravel's queries return nvarchar instead of int?

i have thoses lines of code :
$idprat = Praticien::select('ID_Praticien')->where('NOM',$request->input('ID_Praticien'))->get();
$mission->ID_Praticien = $idprat;
and i have this error message :
la valeur nvarchar '[{"ID_Praticien":1}]' en type de données int
why it's return me nvarchar on a int column on my database ?
i tried to make it correct like this :
$idprat = Praticien::select('ID_Praticien')->where('NOM',$request->input('ID_Praticien'))->get()->first();
and i tried with :
$mission->ID_Praticien = (int)$idprat;
but doesnt work
i just selected ID_Praticien value not an array xD
thanks for help ;)
Try this:
$idprat = Praticien::select('ID_Praticien')->where('NOM',$request->input('ID_Praticien'))->get();
$mission->ID_Praticien = $idprat[0]->ID_Praticien;
or
$idprat = Praticien::select('ID_Praticien')->where('NOM',$request->input('ID_Praticien'))->first();
$mission->ID_Praticien = $idprat->ID_Praticien;

How to filter() interactively a DT by choosing a criterion in a selectInput() and defining the a numericValue()

I'm triying to create a shiny app that allow users to filter a data table by choosing a numeric variable in a selectInput() and a numeric value in a numericValue().
I'm getting erros, whatever I tried
I tried to call a variable in the server function using four ways (input$y, get(input$y), !!get(input$y), !!sym(input$y)), without getting the expected result.
server <- shinyServer(function(input, output){
output$filteredtable <- DT::renderDataTable({
newtab <- movies %>%
dplyr::filter(!!sym(input$y) < !!sym(input$numValue))
DT::datatable(data = newtab)
})
})
I am expecting that the table reacts interactively to the seledcted Input and the defined numeric value.
input$y --> gives an empty table that doesn't interact with what we choose in the selectInput()
get(input$y) --> gives the error: invalid first argument.
!!get(input$y) --> gives the error: object 'runtime' not found ('runtime' is a numeric variable from the used file).
!!sym(input$y) --> gives the error: Only strings can be converted to symbols
For sure #Thomas Fuchs
ui <- shinyUI(
dashboardPage(
dashboardHeader(),
dashboardSidebar(
# Critère du filtre
selectInput(inputId = "y",
label = "Choisir ici le critère du filtre : ",
choices = c("runtime", "thtr_rel_day", "dvd_rel_year","critics_score", "audience_score"),
selected = "runtime"),
# Slider
numericInput(inputId = "numValue",
label = "Choisir une valeur numérique pour le filtre",
value ="500",
min = 1,
max = 1000,
step = 50,
width = '100%')
),
# body
dashboardBody(
fluidPage(
box(DT::dataTableOutput(outputId = "filteredtable"),
title = "Les données filtrées")
)
)
)
)

Convert query a query builder

Possible query a laravel query builder,lo que trato de hacer son las operaciones para calcular el descuto salarial de un dia faltado y si cuenta con prestamo tambien descontarlo
select empleado.sueldo_inci,empleado.sal_diario,
((empleado.sueldo_inci-empleado.sal_diario)-Prestamo.descuento)
as final,Prestamo.descuento from empleado
inner join Prestamo on empleado.idemp=1
\DB::table('empleado')
->join('prestamo', 'empleado.id', 'prestado.empleado_id')
->select(['empleado.sueldo_inci', 'empleado.sal_diario', 'prestamo.descuento'])
->selectRaw('(empleado.sueldo_inci - empleado.sal_diario - prestamo.descuento) AS final')
->get()

How to mask a string in swift 4.2

I wanna make a mask in a string.
let unmasked = "12345678900"
//string masked = "123.456.789-00"
This is the braziliam CPF format, i found nothing in Stack Overflow BR
I found a solution using a character array and array.insert to insert mask in defined index
Portuguese:
Eu encontrei uma solução usando um array de caracteres e a função array.insert que permite inserir qualquer string em um determinado index da matriz.
let cpf = "12345678900"
var characters = Array(cpf) //making a character array (criando um array de caracteres)
characters.insert(".", at: 3) //inserting "." in index 3 (inserindo "." no index 3)
//character = ["1","2","3",".","4","5","6","7","8","9","0","0"]
characters.insert(".", at: 7) // inserting "." in index 7 (inserindo "." no index 7)
//character = ["1","2","3",".","4","5","6",".","7","8","9","0","0"]
characters.insert("-", at: 11)// inserting "." in index 11 (inserindo "." no index 11)
//character = ["1","2","3",".","4","5","6",".","7","8","9","-","0","0"]
let masked = String(characters) //convert character to string
pint("cpf masked: ",masked)
//the masked will show: 123.456.789-00 (a mascara irá mostrar: 123.456.789-00)

Oracle Sql developer how to display null foreign key

I am doing Oracle database project which called "Theatre booking system".
I am trying to display discounted price through Customer_Concession and Member_Concession.
Null-able foreign keys are bookingId, cconcessionId, and mconcessionId in Ticket table.
I want to display all ticket even one of id is not exist.
How can I write the SQL?
Could you help me?
Thanks.
SELECT t.ticketId, pro.name "Production name", PRICE.LEVELID "Price level",
Price.price "Price", (Price.price - ccons.discountPrice - mcons.discountPrice)
"Discounted Price", t.seatNo "Seat", t.rowNo "Row", t.block "Block",
per.performance_date "Performance date", per.start_time "Start time",
per.end_time "End time", t.availability "Availability"
FROM Ticket t, Production pro, Performance per, Price, Price_level,
Booking, Customer, Customer_Concession ccons, Member_concession mcons
WHERE t.performanceid = per.performanceid AND
t.PRODUCTIONID = Price.PRODUCTIONID AND
t.levelId = Price.levelId AND
Price.PRODUCTIONID = pro.PRODUCTIONID AND
Price.levelId = Price_level.levelId AND
t.bookingId = Booking.bookingId AND
Booking.customerId = Customer.customerId AND
ccons.cconcessionId = t.cconcessionId AND
mcons.mconcessionId = t.mconcessionId
ORDER BY t.ticketId
What you are looking for is called LEFT OUTER JOIN.
for more info, visit this site: http://www.oreillynet.com/network/2002/04/23/fulljoin.html
Try...
WHERE t.performanceid = per.performanceid AND
t.PRODUCTIONID = Price.PRODUCTIONID AND
t.levelId = Price.levelId AND
Price.PRODUCTIONID = pro.PRODUCTIONID AND
Price.levelId = Price_level.levelId AND
t.bookingId = Booking.bookingId(+) AND
Booking.customerId = Customer.customerId(+) AND
ccons.cconcessionId(+) = t.cconcessionId AND
mcons.mconcessionId(+) = t.mconcessionId
(note old syntax)

Categories

Resources