I have a Silverlight application which has a RadGridView that is right to left.
when I export the grid, the result is left to right table.
I want the exported table would be in right to left format
(for example in Excel the sheet would be in right to left direction)
Edit not from OP to transfer clarification provided in comment
This picture is from the export result:
and this one is when I change sheet direction manually:
By adding some styling at the header part of your output in the export function, and for the Right-to-left alignment option it's inserted at the <WorksheetOptions> level of the declaration which called <x:DisplayRightToLeft/>.
Example if you're using C# in your project:
private string AddExcelStyling()
{
StringBuilder sb = new StringBuilder();
sb.Append("<html xmlns:o='urn:schemas-microsoft-com:office:office'\n" +
"xmlns:x='urn:schemas-microsoft-com:office:excel'\n" +
"xmlns='http://www.w3.org/TR/REC-html40'>\n" +
"<head>\n");
sb.Append("<style>\n");
sb.Append("#page");
sb.Append("mso-page-orientation:landscape;}\n");
sb.Append("</style>\n");
sb.Append("<!--[if gte mso 9]><xml>\n");
sb.Append("<x:ExcelWorkbook>\n");
sb.Append("<x:ExcelWorksheets>\n");
sb.Append("<x:ExcelWorksheet>\n");
sb.Append("<x:Name>Sheet Name</x:Name>\n");
sb.Append("<x:WorksheetOptions>\n");
sb.Append("<x:Print>\n");
sb.Append("<x:HorizontalResolution>600</x:HorizontalResolution\n");
sb.Append("<x:VerticalResolution>600</x:VerticalResolution\n");
sb.Append("</x:Print>\n");
sb.Append("<x:Selected/>\n");
sb.Append("<x:DisplayRightToLeft/>\n");
sb.Append("<x:DoNotDisplayGridlines/>\n");
sb.Append("</x:WorksheetOptions>\n");
sb.Append("</x:ExcelWorksheet>\n");
sb.Append("</x:ExcelWorksheets>\n");
sb.Append("</x:ExcelWorkbook>\n");
sb.Append("</xml><![endif]-->\n");
sb.Append("</head>\n");
sb.Append("<body>\n");
return sb.ToString();
}
See this link: http://forums.asp.net/p/1445619/3358464.aspx
I still have next to no idea of what is required, but here are some possibilities:
Starting with this:
sort ABC columns: Row / Sort by Row 1; Sort On Values; Order Largest to Smallest to get:
then click on Right-to-Left icon to get:
and sort again (same selection) to get this:
Stop when desired result is achieved.
Delete Row 1.
For code version click on Record Macro and repeat as many of above steps as required.
Stop recording.
Related
I have a Tabulator (4.9.3) with values that use an editor of type text. As I tab through the table, I want each value to be selected so I can overwrite it without having to clear it first. I have tried putting the usual range selection code into the cellEditing callback and the Tabulator source code where the input gets created. Here is one variation of the code (I can't show them all because the node differs based on context):
try {
if (document.selection) {
// IE
var range = document.body.createTextRange();
range.moveToElementText(input);
range.select();
} else if (window.getSelection) {
var range = document.createRange();
range.selectNode(input);
window.getSelection().removeAllRanges();
window.getSelection().addRange(range);
}
} catch (e) {console.log(e);}
If I double-click on the cell, the value selects as desired. How can I get this to work with keyboard navigation as well?
Since the editor is not assigned an id, finding a selector that could find it reliably was problematic without editing the source code. Since I was going to have to edit the source, I ended up adding the following line to the onRendered function of the input element under Edit.prototype.editors.
input.select();
So column width is done using cell width on all cells in one column ike this:
from docx import Document
from docx.shared import Cm
file = /path/to/file/
doc = Document(file)
table = doc.add_table(4,2)
for cell in table.columns[0].cells:
cell.width = Cm(1.85)
however, the row height is done using rows, but I can't remember how I did it last week.
Now I managed to find a way to reference the rows in a table, but can't seem to get back to that way. It is possible to change the height by using the add_row method, but you can't create a table with no rows, so the the top row will always be the default height, which about 1.6cms.
There is a way to access paragraphs without using add_paragraph, does anyone know how to access the rows without using the add_row method because it was that that I used to set row height in a table as a default.
I have tried this but it doesn't work:
row = table.rows
row.height = Cm(0.7)
but although this does not give an error, it also has no effect on the height.
table.rows is a collection, in particular a sequence, so you need to access each row separately:
for row in table.rows:
row.height = Cm(0.7)
Also check out row.height_rule for some related behaviors you have access to:
https://python-docx.readthedocs.io/en/latest/api/table.html#row-objects
When you assign to table.rows.height, it just adds a .height instance attribute that does nothing. It's one of the side-effects of a dynamic language like Python that you encounter a mysterious behavior like this. It goes away as you gain more experience though, at least it has for me :)
Some additional information:
The answer here is correct, but this will give a minimum row height. Using WD_ROW_HEIGHT_RULE.EXACTLY will fix the cell height to the set row height ignoring the contents of the cell, this can result in cropping of the text in an undesirable way.
para = table.cell(0,0).add_paragrph('some text')
SOLUTION:
add_paragraph actually adds a blank line above the text.
Use the following instead to avoid using add_paragraph:
table.cell(0,0).paragraphs[0].text = 'some text'
or using add_run can make it easier to also work with the text:
run = table.cell(0,0).paragraphs[0].add_run('some text')
run.bold = True
I am using c1truedbgrid. I have columns added in the grid with one column having button which is displayed is every row. I need to disable the button in a particular row depending on some business logic. How this can be done?
I am not sure why there aren't any answer.
Its fairly simple. Lets say I want to disable the buttons from those rows where ID is even.
for(int i = 0; i< c1truedbgridobject.Splits[0].Rows.Count; i++)
{
if(Convert.ToInt32(c1truedbgridobject[i,1].ToString())%2 == 0)
{
//Disable here
}
}
However the disable part is dependent on how you are adding button to a cell. Since add button is referenced to whole column and not to a particular cell.
Anyhow using a OwnerDrawCell is also an option.
EDIT:
This seems as a limitation of C1TrueDBGrid. You may use C1FlexGrid as an alternative.
You need to make property of that column as "locked=True" as Below example when you initializing grid.
C1TrueDbGridName.Splits(0).DisplayColumns("YourColumnNameHavingButton").Locked = True
it will make your row not to be editable
I am Android developer .While clicking plus button i need one more row.
For Ex (Edit contacts We are click plus means added one more row and minus means remove that row.Just give me xml layout and sample coding for me.)
Create an onClickListener() for the button. Then reference your tableLayout via
tblLayout = (TableLayout)findViewById(R.id.tableLayout);
then use
TableRow = new TableRow(this);
//Do something with this row
row.setText("...");
//add the row to the tblLayout
tblLayout.addView(row);
I was wondering if it was possible to replace one control in a TableLayoutPanel with another at runtime. I have a combo box and a button which are dynamically added to the TableLayoutPanel at runtime, and when the user selects an item in the combo box and hits the button, I'd like to replace the combobox with a label containing the text of the selected combo box item.
Basically, if I could simply remove the control and insert another at it's index, that would work for me. However I don't see an option like "splice" or "insert" on the Controls collection of the TableLayoutPanel, and I was wondering if there was a simple way to insert a control at a specific index. Thanks in advance.
Fixed this by populating a panel with the two controls I wanted to swap and putting that into the TableLayoutPanel. Then I set their visibility according to which I wanted to see at what time.
This is what I've been able to come up with for what I needed. It gets the position of the ComboBox and makes a new label using the selected value.
// Replaces a drop down menu with a label of the same value
private void lockDropMenu(ComboBox dropControl)
{
TableLayoutPanelCellPosition pos = myTable.GetCellPosition(dropControl);
Label lblValue = new Label();
myTable.Controls.Remove(dropControl);
if (dropControl.SelectedItem != null)
{
lblValue.Text = dropControl.SelectedItem.ToString();
lblValue.Font = lblValue.Font = dropControl.Font;
// Just my preferred formatting
lblValue.AutoSize = true;
lblValue.Dock = System.Windows.Forms.DockStyle.Fill;
lblValue.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
myTable.Controls.Add(lblValue, pos.Column, pos.Row);
}
}