Is it possible to import a Table from RadSpreadsheet like MS Word form MS Excel?
Until now it seems to me, that I only can import it as Plaintext. So the backgroundcolor, etc. goes lost.
Thanks in advance.
Torsten
Until now it seems to me, that I only can import it as Plaintext. So the backgroundcolor, etc. goes lost.
Thanks in advance.
Torsten
3 Answers, 1 is accepted
0
Accepted
Hi Torsten,
I have prepared a sample project showing how you can achieve the desired behaviour. You can find it attached.
Regards,
Nikolay Demirev
Telerik
I have prepared a sample project showing how you can achieve the desired behaviour. You can find it attached.
Regards,
Nikolay Demirev
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Torsten
Top achievements
Rank 1
answered on 21 Nov 2014, 12:25 PM
Thanks for the sample project that helped me a lot.^^
Is it also possible to set the width of the columns? and the width of the table?
I' ve tired this Method but it says its not for "Telerik.Windows.Documents.Flow.Model.Table"
radRichTextBox.ChangeTableGridColumnWidth(table , myCol, new Telerik.Windows.Documents.Model.TableWidthUnit(myWidth));
Also i found the table layouttype. I set it to FixedWidth but where can I set the width?
Regards, Torsten
Is it also possible to set the width of the columns? and the width of the table?
I' ve tired this Method but it says its not for "Telerik.Windows.Documents.Flow.Model.Table"
radRichTextBox.ChangeTableGridColumnWidth(table , myCol, new Telerik.Windows.Documents.Model.TableWidthUnit(myWidth));
Also i found the table layouttype. I set it to FixedWidth but where can I set the width?
Regards, Torsten
0
Hello Torsten,
Here is the modified code from the example which copies the content of the current cell so it copies the cell width too:
Regards,
Nikolay Demirev
Telerik
Here is the modified code from the example which copies the content of the current cell so it copies the cell width too:
Worksheet worksheet =
this
.radSpreadshet.ActiveWorksheet;
TableCell wordCell = table.Rows[row].Cells[col];
CellSelection excelCell = worksheet.Cells[fromIndex.RowIndex + row, fromIndex.ColumnIndex + col];
wordCell.PreferredWidth =
new
TableWidthUnit(TableWidthUnitType.Fixed, worksheet.Columns[fromIndex.ColumnIndex + col].GetWidth().Value.Value);
PatternFill fill = excelCell.GetFill().Value
as
PatternFill;
if
(fill !=
null
)
{
wordCell.Properties.BackgroundColor.LocalValue = fill.PatternColor;
}
wordCell.Borders =
this
.ExcelBordersToWordBorders(excelCell.GetBorders());
CellValueFormat numberFormat = excelCell.GetFormat().Value;
Paragraph paragraph = wordCell.Blocks.AddParagraph();
paragraph.Inlines.AddRun(excelCell.GetValue().Value.GetResultValueAsString(numberFormat));
paragraph.TextAlignment =
this
.radHorizontalAlignmentToAlignment[excelCell.GetHorizontalAlignment().Value];
Regards,
Nikolay Demirev
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.