I neeed to create xls file in write-only mode and customize rows height. But rows height stay by default if i use write_only=True.
row = []
book = Workbook(write_only=True)
sheet = book.create_sheet()
cell_1 = WriteOnlyCell(sheet)
# styling and filling cell data
row.append(cell_1)
cell_2 = WriteOnlyCell(sheet)
# styling and filling cell data
row.append(cell_2)
sheet.append(row)
sheet.row_dimensions[len(sheet.rows)].height = 30
Without write_only all works perfect.
Must be done before any cells are added. See the warning section at the bottom of openpyxl.readthedocs.io/en/latest/optimized.html
Row and Column Dimensions are not available in write-only mode.
Related
With a query I have 3 values that I would like to process further. With the LOV, I only get a return value. Or you can use a plug-in, I've read.
How can I transfer the values from column 1 to text field 1, column 2 to text field 2 and column 3 to text field 3 by clicking on any row in an interactive grid?
I currently have a dynamic action stored in the interactive grid - when you "click".
With "True" I have selected the action "Set value" and as Set Type "Dialog Return Item". Unfortunately, it doesn't work that way.
I am not yet very fit in dealing with APEX and I hope your help.
Marja
add three page items page_item1, page_item2 and page_item1
You can create DA on the interactive grid on event selection change
Event
and action execute JavaScript code
JavaScript code
then write this code
var model = this.data.model;
for ( i = 0; i < this.data.selectedRecords.length; i++ ) {
$s("page_item1", $v("page_item1") += model.getValue( this.data.selectedRecords[i], "COLUMN1"));
$s("page_item2", $v("page_item2") += model.getValue( this.data.selectedRecords[i], "COLUMN2"));
$s("page_item3", $v("page_item3") += model.getValue( this.data.selectedRecords[i], "COLUMN3"));
}
`
I'm using a QtableView to display and edit data from a QsqlTableModel.
Everything's fine : data from a postgreSQL table is displayed, and user can edit it and save modifications.
I want to add a row when uses click on a button. I use the insertRecord method from my QslTableModel.
The row is correctly added in the QTableView.
My problem is :
I want to insert a value from a query in the first cell of this new row. (to automatically populate an unique identifier).
This is my code :
def ajoutlgn(self):
query_idNewLine = QtSql.QSqlQuery(self.db)
if query_idNewLine.exec_('SELECT sp_idsuivi+1 FROM bdsuivis.t_suivprev_tablo ORDER BY sp_idsuivi DESC LIMIT 1'):
while query_idNewLine.next():
identifiant = query_idNewLine.value(0)
#print identifiant
record = QtSql.QSqlRecord()
record.setValue(1,identifiant)
self.model.insertRecord(self.model.rowCount(), record)
The value is not inserted in the new row (but if I enter a value by hand, it works perfectly).
Nevertheless, the query is OK (as I can see with the « print identifiant » line, which returns the expected integer).
Do you see what I'm doing wrong ?
Are there other methods to insert programmatically a value in a QTableView cell?
Or do I have to use a QitemDelegate ?
Thanks for advance.
Finally I found the solution :
This line creates a record, but not a record for my QsqlTableModel
record = QtSql.QSqlRecord()
I replaced it with this one, and it works perfectly :
record = self.model.record()
I wanted to color the complete row based on a value of a column. My query looks like this:
select ID,
DB_NAME,
SERVER_NAME,
DB_STATUS,
SERVER_STATUS,
DB_SERVER_STATUS
from DB_SRVR_STAT_V;
If the DB_SERVER_STATUS = 'A' then I want the row to be colored
green or
if the DB_SERVER_STATUS = 'I' then I want the row to be
colored yellow or
if the DB_SERVER_STATUS = 'RO' then I want the
row to be colored red.
I have been looking to find a way to do this, but I haven't been able to get the result I want.
If your report is an Interactive report, you could highlight the rows on the report by going through Actions -> Format -> Highlight the rows by selecting the desired color and defining the condition for your column.
I need help with customizing a QTableView, I have defined a QTableView as this example show, which I found on the internet:
model = new QStandardItemModel(2,3,this); //2 Rows and 3 Columns
model->setHorizontalHeaderItem(0, new QStandardItem(QString("ID")));
model->setHorizontalHeaderItem(1, new QStandardItem(QString("Name")));
model->setHorizontalHeaderItem(2, new QStandardItem(QString("Description")));
ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
ui->tableView->setModel(model);
How can I define a size for each column separately i.e using percentages:
I would get first column 10% of the width second 50%, third 40%.
When I run the program and double click on a row in the QTableView, I can change the value of the cell clicked on , although I have defined a QTableView onDoubleclick method , I mean its like when you click on rename a file it highlights the text so you can modify, how can I disable that?
How to make the columns resizable, meaning can be resized by dragging their columns edge.
First: Use setColumnWidth() method after setModel(). For example:
//...
ui->tableView->setModel(model);
double ii = ui->tableView->columnWidth(0);
ui->tableView->setColumnWidth(1,0.4*ii);
ui->tableView->setColumnWidth(2,0.5*ii);
Third: To do this remove
ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
from your code.
I have a Ultradropdown in which I have to set the row in select as default. I have a value of the row through which can I make the row selected?
//Code
Dim workflowId = 256
cboWorkflows.ActiveRow = ???
In the above code the dropdown has a column in which one of them contains the value 256. so using that I should now make the row selected in dropdown.
How to achieve this?
If you are aware of the column name you could do it like the following:
For Each row As UltraGridRow In UltraDropDown1.Rows()
If row.Cells("YouDesiredColumnNameHere").Value = 256 Then
row.Activate()
End If
Next
If this is not helpful, please provide me more details about the usage of the UltraDropDown in your application.