You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: libraries/radpdfprocessing/editing/block.md
+71-47Lines changed: 71 additions & 47 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,67 +21,59 @@ The most common usage of __Block__ is to draw flowing content. Similarly to [Fix
21
21
22
22
### Inserting Text
23
23
24
-
Inserting [TextFragments]({%slug radpdfprocessing-model-textfragment%}) is achieved with one of the overloads of the __Insert()__ method. __Example 1__ shows a simple insert by passing a string to the method.
24
+
Inserting [TextFragments]({%slug radpdfprocessing-model-textfragment%}) is achieved with one of the overloads of the __Insert()__ method. __Example 1__ shows all the overloads which allow specifying the styles and font family.
25
25
26
-
27
26
#### __[C#] Example 1: Insert text__
28
27
29
28
{{region cs-radpdfprocessing-editing-block_0}}
30
29
Block block = new Block();
31
30
block.InsertText("Text");
32
-
{{endregion}}
33
-
34
-
35
-
36
-
__Example 2__ demonstrates how to insert text with a specific font family.
37
-
38
31
39
-
#### __[C#] Example 2: Insert text with Arial font family__
There is an additional overload of the InsertText() method enabling you to specify the font family, font style and font weight for the text which you would like to insert.
>The '\r' and '\n' characters don't have the usual meaning of "go to next line" when they are inserted into a PDF document and you cannot simply insert text containing these characters to produce multiline text. Instead, you should insert a line break.
54
42
55
-
56
43
### Inserting Line Break
57
44
58
-
Inserting a line break results in the next element starting on a new line. The action is achieved with the __InsertLineBreak()__ method as shown in __Example 4__.
45
+
Inserting a line break results in the next element starting on a new line. The action is achieved with the __InsertLineBreak()__ method as shown in __Example 2__.
59
46
60
47
61
-
#### __[C#] Example 4: Break the line__
48
+
#### __[C#] Example 2: Break the line__
62
49
63
-
{{region cs-radpdfprocessing-editing-block_3}}
50
+
{{region cs-radpdfprocessing-editing-block_1}}
64
51
block.InsertLineBreak();
65
52
{{endregion}}
66
53
67
-
68
-
69
54
### Inserting Image
70
55
71
56
__Block__ provides the following methods for inserting images:
72
57
73
-
74
58
* block.InsertImage(imageSource);
75
59
* block.InsertImage(stream);
76
60
* block.InsertImage(imageSource, size);
77
61
* block.InsertImage(stream, size);
78
62
* block.InsertImage(imageSource, width, height);
79
63
* block.InsertImage(stream, width, height);
80
64
65
+
#### __[C#] Example 3: Inserting an image__
66
+
67
+
{{region cs-radpdfprocessing-editing-block_2}}
68
+
string imageFilePath = "sample.jpg";
69
+
FileStream fileStream = new FileStream(imageFilePath, FileMode.Open);
70
+
Telerik.Windows.Documents.Fixed.Model.Resources.ImageSource imageSrc = new Telerik.Windows.Documents.Fixed.Model.Resources.ImageSource(fileStream);
71
+
72
+
block.InsertImage(imageSrc, 300, 200);
73
+
{{endregion}}
81
74
82
75
Information on images in the context of the library is available in the [ImageSource]({%slug radpdfprocessing-model-imagesource%}) and [Image]({%slug radpdfprocessing-model-image%}) articles.
83
76
84
-
85
77
### Inserting Geometries
86
78
87
79
[Geometries]({%slug radpdfprocessing-concepts-geometry%}) allow you to describe 2D shapes in a document. The following methods can be used to insert different geometries.
@@ -93,6 +85,19 @@ Information on images in the context of the library is available in the [ImageSo
93
85
* block.**InsertPath**(geometry);
94
86
* block.**InsertRectangle**(rectangle);
95
87
88
+
#### __[C#] Example 4: Inserting a geometry__
89
+
90
+
{{region cs-radpdfprocessing-editing-block_3}}
91
+
Telerik.Windows.Documents.Fixed.Model.Graphics.RectangleGeometry rectangleGeometry = new Telerik.Windows.Documents.Fixed.Model.Graphics.RectangleGeometry();
92
+
// .NET Framework
93
+
rectangleGeometry.Rect = new System.Windows.Rect(10, 10, 400, 300);
@@ -219,23 +239,26 @@ A Block can be drawn to the content using the __Draw()__ method. The method acce
219
239
220
240
## Measuring Block Size
221
241
222
-
Measuring a Block can be achieved with one of the overloads of the __Measure()__ method. Invoking the method without a parameter will return the desired size of the elements in the block and set the block's __DesiredSize__ property. The method is handy when you want to determine the size of the Block. When you want to wrap the text or you page has a limited space make sure to pass the available size to the method.
223
-
224
-
Calling the overload accepting available size measures the block in that specific size. Additionally to setting the __DesiredSize__ property, it sets the __PendingElements__ property with a collection of the elements that could not fit in the available size.
225
-
242
+
Measuring a __Block__ can be achieved with one of the two overloads of the __Measure()__ method.
226
243
227
-
__Example 8__ creates a Block with the text "Hello RadPdfProcessing!" and measures it.
228
-
244
+
Invoking the method without a parameter will return the desired size of the block elements and set it as the block's __DesiredSize__ property. The method is handy when you want to determine what size the __Block__ should be depending on its content.
229
245
230
-
#### __[C#] Example 8: Measure block__
246
+
__Example 8__ Creates a __Block__ with text, measures the text, and sets the block size to match the content size.

252
+
253
+
The second overload accepts available __Size__. Calling it measures the block content as if the __Block__ was in that specific size.
254
+
Additionally to setting the __DesiredSize__ property, it also sets the __PendingElements__ property with a collection of the elements that could not fit in the available size.
255
+
256
+
__Example 9__ Creates a __Block__ with text and draws it with a specific size using the [RadFixedContentEditor]({%slug radpdfprocessing-editing-fixedcontenteditor%}). The block content auto fits to the dimentions of the __Block__. The size of the auto fitted content can then be measured.
Telerik.Windows.Documents.Fixed.FormatProviders.Text.TextFormatProvider provider = new Telerik.Windows.Documents.Fixed.FormatProviders.Text.TextFormatProvider();
34
-
RadFixedDocument document = CreateRadFixedDocument();// CreateRadFixedDocument() is a custom method that creates a simple instance of RadFixedDocument. You can replace it with the instance you would like to export.
Telerik.Windows.Documents.Fixed.FormatProviders.Text.TextFormatProvider textFormatProvider = new Telerik.Windows.Documents.Fixed.FormatProviders.Text.TextFormatProvider();
34
+
35
+
RadFixedDocument document = new RadFixedDocument();
36
+
using (RadFixedDocumentEditor radFixedDocumentEditor = new RadFixedDocumentEditor(document))
Copy file name to clipboardExpand all lines: libraries/radspreadprocessing/getting-started.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -158,6 +158,8 @@ For more examples and application scenarios of Importing and Exporting a Workboo
158
158
159
159
>More information about the import and export functionalities of RadSpreadProcessing is available in the [Formats and Conversion section]({%slug radspreadprocessing-formats-and-conversion-general-information%}).
160
160
161
+
For more complete examples head to the [Developer Focused Examples]({%slug radspreadprocessing-sdk-examples%}) section of the library.
162
+
161
163
## Using RadSpreadsheet
162
164
163
165
__RadSpreadsheet__ is a UI control part of the Telerik UI for WPF/Silverlight suites. The document model explained in this section of the documentation and all its features are shared between the __RadSpreadProcessing__ library and __RadSpreadsheet__. [This help section](http://docs.telerik.com/devtools/wpf/controls/radspreadsheet/overview.html) contains information about all UI-specific features of __RadSpreadsheet__.
@@ -50,10 +50,10 @@ Once you have a __CellSelection__ instance, you can easily set and retrieve the
50
50
With one minor exception, the get methods of all cell properties return an object of type __RangePropertyValue<T>__. The class exposes two properties that indicate the value of the property for the cell range:
51
51
52
52
53
-
*__IsIndeterminate__: Indicates whether the value of the retrieved property is consistent among all cells in the specified CellSelection. If the property has one and the same value for all cells, __IsIndeterminate__ is set to false. However, if the value of the retrieved property varies throughout the cells in the CellSelection, the __IsIndeterminate__ property is set to true and the __Value__ property of the __RangePropertyValue<T>__ class is set to its default value.
53
+
*__IsIndeterminate__: Indicates whether the value of the retrieved property is consistent among all cells in the specified __CellSelection__. If the property has one and the same value for all cells, __IsIndeterminate__ is set to false. However, if the value of the retrieved property varies throughout the cells in the __CellSelection__, the __IsIndeterminate__ property is set to true and the __Value__ property of the __RangePropertyValue<T>__ class is set to its default value.
54
54
55
55
56
-
*__Value__: Contains the value of the retrieved property. If the __IsIndeterminate__ property is set to false, __Value__ contains the value of the retrieved property for the whole CellSelection region. If the __IsIndeterminate__ property is set to true, the __Value__ property is set to its default value.
56
+
*__Value__: Contains the value of the retrieved property. If the __IsIndeterminate__ property is set to false, __Value__ contains the value of the retrieved property for the whole __CellSelection__ region. If the __IsIndeterminate__ property is set to true, the __Value__ property is set to its default value.
57
57
58
58
59
59
## Cell Properties
@@ -142,7 +142,7 @@ __Example 3__ illustrates who to retrieve the value of cell B2.
142
142
143
143
144
144
145
-
As the document model supports different types of cell values, the CellSelection class offers multiple overloads of the __SetValue()__ method that allow you to produce different types of values. For example, if you choose the method that accepts a double instance, the __Value__ of the cell will be an instance of NumberCellValue. The __SetValue()__ method has three more overloads that take DateTime, string and ICellValue, respectively.
145
+
As the document model supports different types of cell values, the __CellSelection__ class offers multiple overloads of the __SetValue()__ method that allow you to produce different types of values. For example, if you choose the method that accepts a double instance, the __Value__ of the cell will be an instance of NumberCellValue. The __SetValue()__ method has three more overloads that take DateTime, string and ICellValue, respectively.
146
146
147
147
148
148
__Example 4__ demonstrates how to set the value of a given selection.
@@ -268,7 +268,7 @@ The result of __Example 7__ is illustrated in __Figure 3__.
268
268
269
269
## Indent Property
270
270
271
-
In addition to the __GetIndent()__, __SetIndent()__ and __ClearIndent()__ methods, CellSelection offers two more methods that are used to increase and decrease the value of the __Indent__ property. Those methods are __IncreaseIndent()__ and __DecreaseIndent()__ and neither of them takes arguments. __Example 8__ snippet shows how to use the methods.
271
+
In addition to the __GetIndent()__, __SetIndent()__ and __ClearIndent()__ methods, __CellSelection__ offers two more methods that are used to increase and decrease the value of the __Indent__ property. Those methods are __IncreaseIndent()__ and __DecreaseIndent()__ and neither of them takes arguments. __Example 8__ snippet shows how to use the methods.
272
272
273
273
274
274
#### __[C#] Example 8: Increase and decrease indent__
@@ -285,7 +285,7 @@ In addition to the __GetIndent()__, __SetIndent()__ and __ClearIndent()__ method
285
285
286
286
287
287
## See Also
288
-
288
+
*[Accessing Cells of a Worksheet - CellSelection] ({%slug radspreadprocessing-working-with-cells-accessing-cells-of-worksheet%})
289
289
*[Cell Value Types]({%slug radspreadprocessing-working-with-cells-cell-value-types%})
0 commit comments