Telerik Forums
UI for WPF Forum
2 answers
227 views
I am using ServiceStack Ormlite for my data access and have a table with several million rows of data. Downloading this all locally to display in the RadGridView is not a good solution.

I have spent several hours now trying to figure out how to convert the FilterDescriptors and SortDescriptors to linq so that I can use them in Ormlite. It seems this is impossible. I have also tried the VirtualQueryableCollectionView, but run into the same issues.

The only solution I see now is to use EntityFramework for this data which I really don't want to do.
Datafyer
Top achievements
Rank 1
Veteran
 answered on 03 Oct 2014
7 answers
394 views
Hi All

is it possble to change the size of TileListItem accornig to some ratio

For example :
Item 1   20*20
Item  2  20*20
Item 3  20*100
Item 4   20*20
item 5   40*40
....
...
....
...

Is This possible ?

Regards
Yoan
Telerik team
 answered on 03 Oct 2014
1 answer
130 views
Hi,

I want to place labels directly on the border of the pie, so that half of the label should be onto the pie, and other half should be out of the pie.

I’ve found a Margin property of ChartSeriesLabelDefinition but it does not fulfill my goal. Margin >= 0 draws labels onto the pie (closely to its center), and Margin < 0 draws them out of the pie (with different offsets, btw). I need some interjacent position. Is there any workaround?

Thanks.
Pavel R. Pavlov
Telerik team
 answered on 03 Oct 2014
5 answers
245 views
Hi,

I am using the last internal build.

I am setting up a combo box using the following xaml:

<telerik:GridViewDataColumn DataMemberBinding="{Binding TrueType.Name}"
    <telerik:GridViewDataColumn.CellEditTemplate> 
        <DataTemplate> 
            <ComboBox SelectedItem="{Binding TrueType}" DisplayMemberPath="Name" ItemsSource="{Binding TrueTypeValues}"/>    
        </DataTemplate> 
    </telerik:GridViewDataColumn.CellEditTemplate> 
</telerik:GridViewDataColumn> 
 

What happens after that is quiet random.  On some computer, the combobox will work fine for a couple of tries.  And on some computer, the combobox simply refuse to open.  We click on it and nothing happens.  We can notice a tiny window that flash for .1 second on the top left corner of the screen when that happens the first time.
Yoan
Telerik team
 answered on 03 Oct 2014
9 answers
614 views
Hello,
How is the IsComboBoxEditable property works? I need to present a grid where one column is a combobox. The user can select one value from the list or enter a new value so I set the IsComboBoxEditable to true but the problem is that if the user types a value that is not in the ItemsSource the Text is blank when the combobox looses the focus. Can you please tell me what I'm doing wrong?

 

 

<Telerik:GridViewComboBoxColumn Header="Location" Width="110" IsComboBoxEditable="True"

 

 

SelectedValueMemberPath="Name"

 

 

DisplayMemberPath="Name"

 

 

DataMemberBinding="{Binding [Location]}"/>

 


In code I bind the Itemsource to the available list.

((

GridViewComboBoxColumn)tblTrain.Columns[2]).ItemsSource = GetTrainToFacilities();

 

Yoan
Telerik team
 answered on 03 Oct 2014
15 answers
1.2K+ views
How can I programmatically create, using C# and RadDocument, a Microsoft Word document with a cover page, table of contents, then body with several sections and subsections?

- It is a simple document assembly operation
- It is for a desktop WPF application, C#, .NET 4.5
- The document is relatively short with less than 10 top level sections and less than 25 subsections
- The number of sections is variable depending on the data entered in the rest of the desktop application
- The document created should be in MS Word 2010 format if possible.
- The document is created without a Telerik RichTextEdit control visible.  Currently, there is no Telerik RichTextEdit control used in the application.I've attached a sample Word 2010 document.

Attached are the pages from the sample Word document with dummy data.


The attached short 3 page Word document with dummy data gives the basic layout.
C
Top achievements
Rank 1
 answered on 01 Oct 2014
2 answers
143 views
Hi there,

Version: 2013.2.611.45

I have a word document that i am importing and working with. It's a form that has a 3 of 9 barcode string vertically in the left margin. When I import the document and show it in the editor, the barcode is no longer top to bottom direction but left to right,.

I read around this forum and stackoverflow and I gathered that text direction is not supported at this point in time. Has this changed at all since our version?

I also tried the suggestion of using a WPF label rotated and put inside a UIInlineContainer and inserted into the editor, which works fine, but as i came across in the documentation these are not saved when output to docx, which i must do.

Do i have any options whatsoever to at least simulate rotated text?

Many thanks for your time,
J
C
Top achievements
Rank 1
 answered on 01 Oct 2014
2 answers
595 views
How do you change the font size, color, weight, etc. when writing a Microsoft Word document using RadDocumentEditor?

The Word document created has all font in Calibri 6 point normal weight black in Microsoft Word 2010..
It should have different sizes/weights/colors of Calibri and Arial text.

{
RadDocument doc = new RadDocument();
RadDocumentEditor ed = new RadDocumentEditor(doc);

doc.SectionDefaultPageSize = PaperTypeConverter.ToSize(PaperTypes.Letter);
doc.SectionDefaultPageOrientation = PageOrientation.Portrait;
doc.SectionDefaultPageMargin = new Padding(50);

FontFamily fontCalibri = new FontFamily("Calibri");
FontFamily fontArial = new FontFamily("Arial");


ed.ChangeFontFamily(fontCalibri);
ed.ChangeFontSize(8.0);
ed.Insert("Test inserted Calibri");
ed.InsertLineBreak();

ed.ChangeFontFamily(fontArial);
ed.ChangeFontSize(12.0);
ed.Insert("Test inserted Arial");
ed.InsertLineBreak();

ed.ChangeFontFamily(fontCalibri);
ed.ChangeFontSize(15.0);
ed.ChangeFontWeight(FontWeights.Bold);
ed.Insert("Test inserted Calibri 2 bold");
ed.InsertLineBreak();

ed.ChangeFontFamily(fontCalibri);
ed.ChangeFontSize(30.0);
ed.ChangeForeColor(Color.FromRgb(255, 0, 0));
ed.ChangeFontStyle(FontStyles.Italic);
ed.ChangeFontWeight(FontWeights.Bold);
ed.Insert("Test inserted Calibri 2 bold itallic");
ed.InsertLineBreak();

doc.MeasureAndArrangeInDefaultSize();
ExportToWordDocx(doc, "test_report_doc_1.docx");
}

We are using C#, .net 4.5 and Telerik version 2014.2.617.45 of Telerik.Windows.Documents, Documents.Core and Documents.FormatProviders.OpenXmkl


C
Top achievements
Rank 1
 answered on 01 Oct 2014
2 answers
390 views
How should the TableWidthUnitType.Percent be used?  The TableWidthUnitType.Percent seems to be ignored in the following simple example.
Is there some other setting that needs to be done for the table to take up 100% of the page width excluding margins?

The tables are in the header and footer and need to take up 100% of the page width on each page without regard to page orientation.

internal class Test1
{
internal static void GenerateDocumentTest1()     //this is the main method
{
RadDocument document = new RadDocument();
document.LayoutMode = DocumentLayoutMode.Paged;  

//NOTE: Sizes used by Telerix RadDocument are in Device Independent Pixels (DIP) which are 96 to the inch
//  An 8.5 inch by 11 inch paper size is (8.5 * 96) DIP wide by (11 * 96) DIP tall
//  Use the Unit.InchToDip() conversion method to convert from inches to DIP.  The Unit class does other measurement conversions

document.SectionDefaultPageSize = PaperTypeConverter.ToSize(PaperTypes.Letter);
document.SectionDefaultPageOrientation = PageOrientation.Portrait;
const double pageSizeWidthInches = 8.5;
const double pageMarginSizeInches = 0.5; //page margin on all four sides of the page

const double pageContentWidthSizeInInches = pageSizeWidthInches - (2.0*pageMarginSizeInches); //printable area width of page - used for setting table widths in header and footer
int marginSizeDip = (int) Unit.InchToDip(pageMarginSizeInches); //Note: 96 DIP to the inch
document.SectionDefaultPageMargin = new Padding(marginSizeDip); // 50/100 of an inch for all margins

//------------------------------------------------------------
//build page headers to be applied to document
Header pageHeader = CreatePageHeader();
Footer pageFooter = CreatePageFooter();
{
Section sec = new Section() { PageOrientation = PageOrientation.Portrait};
Paragraph par = new Paragraph();
par.Inlines.Add(new Span("First Page Text A"));
sec.Blocks.Add(par);
sec.Headers.Default = pageHeader;
sec.Footers.Default = pageFooter;
document.Sections.Add(sec);
}

//---------------------------------------------------------
{
Section sec = new Section() { PageOrientation = PageOrientation.Landscape };
Paragraph par = new Paragraph();
par.Inlines.Add(new Span("Second Page Text B"));
par.Inlines.Add(new Span(DocumentEnvironment.NewLine));
sec.Blocks.Add(par);
sec.Headers.Default = pageHeader;
sec.Footers.Default = pageFooter;
document.Sections.Add(sec);
}

//---------------------------------------------------------
{
Section sec = new Section() { PageOrientation = PageOrientation.Portrait };
Paragraph par = new Paragraph();
par.Inlines.Add(new Span("Second Page Text B"));
par.Inlines.Add(new Span(DocumentEnvironment.NewLine));
sec.Blocks.Add(par);
sec.Headers.Default = pageHeader;
sec.Footers.Default = pageFooter;
document.Sections.Add(sec);
}

//---------------------------------------------------------------------
document.EnsureDocumentMeasuredAndArranged();
ExportToWordDocx(document, "test_sample_doc.docx");
}

private static Footer CreatePageFooter()
{
//Page footer is a RadDocument that is inserted into the main RadDocument
RadDocument doc = new RadDocument();
Section sec = new Section();
sec.Blocks.Add(CreateHeaderFooterTable("Footer text (a)", "Footer text (b)"));
doc.Sections.Add(sec);
doc.MeasureAndArrangeInDefaultSize();
Footer footer = new Footer() { Body = doc };
return (footer);
}

private static Header CreatePageHeader()
{
//Page header is a RadDocument that is inserted into the main RadDocument
RadDocument doc = new RadDocument();
Section sec = new Section();
sec.Blocks.Add(CreateHeaderFooterTable("Header text (a)", "Header text (b)"));
doc.Sections.Add(sec);
doc.MeasureAndArrangeInDefaultSize();
Header header = new Header() {Body = doc};
return (header);
}

private static Table CreateHeaderFooterTable(string leftString, string rightString)
{
Table table = new Table();
table.PreferredWidth = new TableWidthUnit(TableWidthUnitType.Percent, 100.0); //fit to page width
//table.PreferredWidth = new TableWidthUnit(TableWidthUnitType.Fixed, Unit.InchToDip(tableWidthInches));

table.StyleName = RadDocumentDefaultStyles.DefaultTableGridStyleName;

//table.Borders = new TableBorders(new Border(BorderStyle.None)); //set no borders for table - borders will be done at the cell level
table.Borders = new TableBorders(new Border(BorderStyle.Single)); //diagnostic - show single line border//Must use TableBorders() default constructor and then do a .SetBottom(border type) before assigning it to table.Borders
//Border noBorder = new Border(BorderStyle.None);
//table.Borders = new TableBorders().SetLeft(noBorder).SetTop(noBorder).SetRight(noBorder).SetBottom(noBorder);

TableRow row = new TableRow();{
TableCell cell = new TableCell();
cell.PreferredWidth = new TableWidthUnit(TableWidthUnitType.Percent, 50.0);//to set cell borders you have to create a TableCellBorders object with the default constructor and then do a SetBottom(), SetTop(), ... for each of the sides of the cell
//cell.Borders = new TableCellBorders().SetBottom(new Border(1.0f, BorderStyle.Single, Color.FromRgb(0, 0, 255)));

Paragraph par = new Paragraph();
par.Inlines.Add(new Span(leftString));
cell.Blocks.Add(par);row.Cells.Add(cell);
}

{
TableCell cell = new TableCell();
cell.PreferredWidth = new TableWidthUnit(TableWidthUnitType.Percent, 50.0);
cell.TextAlignment = RadTextAlignment.Right;Paragraph par = new Paragraph();
par.Inlines.Add(new Span(rightString));
cell.Blocks.Add(par);
row.Cells.Add(cell);
}

table.Rows.Add(row);return (table);

}

private static void ExportToWordDocx(RadDocument document, string fileName)
{
using (Stream outStream = new FileStream(fileName, FileMode.Create))
{
DocxFormatProvider provider = new DocxFormatProvider();
provider.Export(document, outStream);
}
}
}

C
Top achievements
Rank 1
 answered on 01 Oct 2014
3 answers
330 views
How do you set the size of an inline image added to Word docx document using RadDocument?
We need to add the image to a table and have the image scaled at 100%.  It scales the image at 156% when exporting to Word docx format
Images added outside of a table are sized at 100% and not scaled up.

When we use the following code to add an image outside of a table,.

//Setup RadDocument
RadDocument document = new RadDocument() { LayoutMode = DocumentLayoutMode.Paged };
document.SectionDefaultPageSize = PaperTypeConverter.ToSize(PaperTypes.Letter);
document.SectionDefaultPageOrientation = PageOrientation.Portrait;

const double pageMarginSizeInches = 0.5;
int marginSizeDip = (int) Unit.InchToDip(pageMarginSizeInches);
document.SectionDefaultPageMargin = new Padding(marginSizeDip);

//Add text and other document content

AddImageTable(document);

//add more text and document content//output to .docx file

//write to .docx file
using (Stream outStream = new FileStream("out.doc, FileMode.Create))
 {
  DocxFormatProvider provider = new DocxFormatProvider();
  provider.Export(document, outStream);
 }

//end of program

void AddImageTable(RadDocument document)
{
Section section = new Section();

System.Drawing.Bitmap testImage = ( a 500 pixel by 500 pixel bitmap image taken of an application window)

Table table = new Table();
table.StyleName = RadDocumentDefaultStyles.DefaultTableGridStyleName;
row = new TableRow();
TableCell cell = new TableCell() { PreferredWidth = new TableWidthUnit(TableWidthUnitType.Percent, 20.0f)  };

Paragraph par = new Paragraph();
par.Inlines.Add(new Span("Image test"))

cell.Blocks.Add(par);
row.Cells.Add(cell);

cell = new TableCell() { PreferredWidth = new TableWidthUnit(TableWidthUnitType.Percent, 80.0f) };
cell.Blocks.Add(AddImage(null, testImage, 0.0f));
row.Cells.Add(cell);

table.Rows.Add(row);

section.Blocks.Add(table);
document.Sections.Add(section);
}

static Paragraph AddImage(string imagePath, System.Drawing.Bitmap bitmapImage)
{   //add image from the assembly resource or from a Bitmap
 try
 {
  ImageInline imageTmp;
  Stream inStream;
  
  if (String.IsNullOrWhiteSpace(imagePath) == false)
  {
   inStream = Application.GetResourceStream(new Uri(imagePath, UriKind.RelativeOrAbsolute)).Stream;
   imageTmp = new ImageInline(inStream);
  }
  else
  {
   inStream = new MemoryStream();
   bitmapImage.Save(inStream, ImageFormat.Png);
   imageTmp = new ImageInline(inStream, new Size(bitmapImage.Width, bitmapImage.Height), "png");
  }  

Paragraph par = new Paragraph();
 par.Inlines.Add(imageTmp);  
inStream = null;
 return (par);
 }
 catch (Exception ex)
 {
  System.Diagnostics.Debug.WriteLine("AddInlinePicture() - exception - " + ex.ToString() + "\n\n");
  throw;
 }
}


C
Top achievements
Rank 1
 answered on 01 Oct 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?