Telerik Forums
UI for WPF Forum
3 answers
447 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
3 answers
176 views
Hello,

    When creating a raddocument, if you create a table add it, then create another table right after it, the expected functionality is not there.  Using the sample code found at "http://www.telerik.com/help/wpf/radrichtextbox-features-document-elements-tables.html", moving the creating of the table to a function and then doing the following causes the program to select more than desired.

RadDocument document = new RadDocument();
Section section = new Section();
            
section.Blocks.Add(new Paragraph());
section.Blocks.Add(CreateTable());
section.Blocks.Add(CreateTable());
section.Blocks.Add(new Paragraph());
document.Sections.Add(section);

radRichTextBox1.Document = document;

Now if I hover over the second table, and press the "select all" icon that appear in the upper left hand corner, it will select the table as expected, and the last row of the previous table. 

Since the RadDocument does not support list indenting, before I go to print a document, I have to fake it out by creating a bunch of tables/paragraphs to create this functionality.  So a document that has lets say, 100 tables, if you click in the upper left hand corner, it will crash the program either right away giving a cannot convert error, or after freezing it will wait a bit and then run out of memory.

The above functionality is negated of course if I insert a paragraph in-between tables, however that is not the desired functionality and kind of a waste of resources.

So is there anyway to ensure the grid cannot have the "Select All" icon appear?  If not, is there anything I can do other than inserting something in-between the tables?  If I do have to insert something in-between the tables, is a Paragraph my best bet?

Thanks and Kind Regards,



C
Top achievements
Rank 1
 answered on 01 Oct 2014
1 answer
252 views
Hi,

When the radgridview AddNewRowPosition property NewRowPosition is set to Bottom and the grid doesn't have any items, the add function is hidden. This means I cannot add any new items.
It's working when I set the property to 'Top', but I want the items to be inserted at the bottom..

Is this a known bug? Is there a workaround available?

Thanks,
Jorik
Yoan
Telerik team
 answered on 01 Oct 2014
1 answer
129 views
Hello,

I have a simple application containing a RadGridView with the ItemsSource binded to an ObservableCollection of elements. I use the RowLoaded event to set the background of the cells and it works fine.
Here is the code i use in the RowLoaded:
            string colorStr = "#5cfc56";
            SolidColorBrush b = new SolidColorBrush();
            b.Color = (Color)ColorConverter.ConvertFromString(colorStr);
            var cell= (from a in e.Row.Cells where a.Column.UniqueName == "a" select a).FirstOrDefault();
            cell.Background = b;
            cell.ToolTip = "aaaas";

The problem is that when i refresh the ObservableCollection with new elements the grid does not apply the background color to the rows in spite of launching the RowLoadedEvent however the Tooltip of the cell works.

Is there something i'm doing wrong here?


Tanks.







Yoan
Telerik team
 answered on 01 Oct 2014
2 answers
270 views
Hi,

We are trying to create a workflow using Raddiagram, and after adding shapes and connection the diagram looks like attached image. I am looking for formatting the connections in a way they are more better like am seeing in the demo for swimlan diagram, But am finding difficulties to format the connections. Can you please help me with this.

Thank you
Muthukumar
Top achievements
Rank 2
 answered on 01 Oct 2014
1 answer
169 views
I've already changed the diagram's activetool to the pan tool, but this does not seem to take affect when the mouse is over a container shape, some of my container shapes are very large, and I don't really need the capability to select them, so is it possible to make the mouse pan while over a container shape?
Martin Ivanov
Telerik team
 answered on 01 Oct 2014
1 answer
135 views
Hi,

I would like to know if it's possible set a value to the HighlightedIndex property of the RadListBox part in the AutoCompletBox?

Thank's
Alain
Kalin
Telerik team
 answered on 01 Oct 2014
12 answers
516 views
Hi All,
Can you please see this video: https://www.youtube.com/watch?v=UtJ85t8URUU

I move to next column with tab. Currently when I am on the last column and click tab the cursor go to next row first editable column.
How can go do a grid.BeginInsert() and go there to add a new item and not to go on edit row in next line. We need this only when tab is clicked from the last column.

Regards
Boris
Telerik team
 answered on 01 Oct 2014
0 answers
165 views
Hi,

using c# - wpf - NET 4.5

we have to create a dynamic mask. Our application should get a mask with fields, ids, position from a extern file.
Later the user should edit this mask, so we have to save the changes.

Is this possible and how can we do this?

Thanks a lot
Best Regards
Rene
ITA
Top achievements
Rank 1
 asked on 01 Oct 2014
1 answer
118 views
Hi,

I am trying to call rad schedule view drag drop behavior in a menu item click. Similar to copy and paste from one grid to another.
We already have drag drop code in place which will work with DragDropState as input parameter. Is it possible to pass our custom drag drop state with our list of DestinationSlots and DraggedAppointments to drop method? So that, we can use the same code which used for drag drop in menu click also.

Regards,
Sugumar P
Sugumar
Top achievements
Rank 1
 answered on 30 Sep 2014
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
DataPager
PersistenceFramework
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
InlineAIAssistant
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?