Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs feedback #471

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 71 additions & 47 deletions libraries/radpdfprocessing/editing/block.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,67 +21,59 @@ The most common usage of __Block__ is to draw flowing content. Similarly to [Fix

### Inserting Text

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.
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.


#### __[C#] Example 1: Insert text__

{{region cs-radpdfprocessing-editing-block_0}}
Block block = new Block();
block.InsertText("Text");
{{endregion}}



__Example 2__ demonstrates how to insert text with a specific font family.


#### __[C#] Example 2: Insert text with Arial font family__
// .NET Framework
block.InsertText(new System.Windows.Media.FontFamily("Arial"), "Text");
block.InsertText(new System.Windows.Media.FontFamily("Arial"), System.Windows.FontStyles.Italic, System.Windows.FontWeights.Bold, "Text");

{{region cs-radpdfprocessing-editing-block_1}}
block.InsertText(new FontFamily("Arial"), "Text");
{{endregion}}

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.

#### __[C#] Example 3: Insert styled text__

{{region cs-radpdfprocessing-editing-block_2}}
block.InsertText(new FontFamily("Arial"), FontStyles.Italic, FontWeights.Bold, "Text");
// .NET Standard
//block.InsertText(new Telerik.Documents.Core.Fonts.FontFamily("Arial"), "Text");
//block.InsertText(new Telerik.Documents.Core.Fonts.FontFamily("Arial"), Telerik.Documents.Core.Fonts.FontStyles.Italic, Telerik.Documents.Core.Fonts.FontWeights.Bold, "Text");
{{endregion}}

>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.


### Inserting Line Break

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__.
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__.


#### __[C#] Example 4: Break the line__
#### __[C#] Example 2: Break the line__

{{region cs-radpdfprocessing-editing-block_3}}
{{region cs-radpdfprocessing-editing-block_1}}
block.InsertLineBreak();
{{endregion}}



### Inserting Image

__Block__ provides the following methods for inserting images:


* block.InsertImage(imageSource);
* block.InsertImage(stream);
* block.InsertImage(imageSource, size);
* block.InsertImage(stream, size);
* block.InsertImage(imageSource, width, height);
* block.InsertImage(stream, width, height);

#### __[C#] Example 3: Inserting an image__

{{region cs-radpdfprocessing-editing-block_2}}
string imageFilePath = "sample.jpg";
FileStream fileStream = new FileStream(imageFilePath, FileMode.Open);
Telerik.Windows.Documents.Fixed.Model.Resources.ImageSource imageSrc = new Telerik.Windows.Documents.Fixed.Model.Resources.ImageSource(fileStream);

block.InsertImage(imageSrc, 300, 200);
{{endregion}}

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.


### Inserting Geometries

[Geometries]({%slug radpdfprocessing-concepts-geometry%}) allow you to describe 2D shapes in a document. The following methods can be used to insert different geometries.
Expand All @@ -93,6 +85,19 @@ Information on images in the context of the library is available in the [ImageSo
* block.**InsertPath**(geometry);
* block.**InsertRectangle**(rectangle);

#### __[C#] Example 4: Inserting a geometry__

{{region cs-radpdfprocessing-editing-block_3}}
Telerik.Windows.Documents.Fixed.Model.Graphics.RectangleGeometry rectangleGeometry = new Telerik.Windows.Documents.Fixed.Model.Graphics.RectangleGeometry();
// .NET Framework
rectangleGeometry.Rect = new System.Windows.Rect(10, 10, 400, 300);
block.InsertRectangle(new System.Windows.Rect(10, 10, 200, 150));
// .NET Standard
//rectangleGeometry.Rect = new Telerik.Documents.Primitives.Rect(10, 5, 400, 300);
//block.InsertRectangle(new Telerik.Documents.Primitives.Rect(20, 30, 200, 150));

block.InsertPath(rectangleGeometry);
{{endregion}}

### Inserting Form-XObject Elements

Expand All @@ -101,6 +106,13 @@ The Form (or also known as Form-XObject) is an object that can contain PDF conte
#### __[C#] Example 5: Insert a form__

{{region cs-radpdfprocessing-editing-block_4}}
FormSource simpleForm = new FormSource();
simpleForm.Size = new System.Windows.Size(310, 250); // .NET Framework
//simpleForm.Size = new Telerik.Documents.Primitives.Size(310, 250); // .NET Standard

FixedContentEditor formEditor = new FixedContentEditor(simpleForm);
formEditor.DrawText("Sample text.");

block.InsertForm(simpleForm);
{{endregion}}

Expand Down Expand Up @@ -180,26 +192,34 @@ The __Block__ class has some properties and methods that affect how it will be r
#### __[C#] Example 6: Change Block properties__

{{region cs-radpdfprocessing-editing-block_5}}
Block block = new Block();
block.InsertText("block content");
RadFixedDocument radFixedDocument = new RadFixedDocument();
RadFixedPage page = radFixedDocument.Pages.AddPage();

Block block = new Block();
block.GraphicProperties.FillColor = new RgbColor(100, 0, 0, 0);
block.SpacingBefore = 10;
block.SpacingAfter = 5;
block.LineSpacingType = HeightType.Exact;
block.LineSpacing = 15;
block.FirstLineIndent = 12;
block.FirstLineIndent = 0;
block.LeftIndent = 0;
block.RightIndent = 0;
block.BackgroundColor = RgbColors.White;
block.BackgroundColor = new RgbColor(100, 255, 0, 0);
block.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Left;
block.VerticalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.VerticalAlignment.Top;
block.InsertText("block content");

var textFragment = new TextFragment();
textFragment.Text = "test bullet";
block.Bullet = textFragment;
block.IndentAfterBullet = 5;
TextFragment bulletTextFragment = new TextFragment();
bulletTextFragment.Text = "•";
block.Bullet = bulletTextFragment;
block.IndentAfterBullet = 15;

var editor = new FixedContentEditor(page);
editor.Position.Translate(50,50);
editor.DrawBlock(block);
{{endregion}}

![Block Properties Result](images/radpdfprocessing-editing-block_5_result.png)

## Drawing a Block

Expand All @@ -219,23 +239,26 @@ A Block can be drawn to the content using the __Draw()__ method. The method acce

## Measuring Block Size

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.

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.

Measuring a __Block__ can be achieved with one of the two overloads of the __Measure()__ method.

__Example 8__ creates a Block with the text "Hello RadPdfProcessing!" and measures it.

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.

#### __[C#] Example 8: Measure block__
__Example 8__ Creates a __Block__ with text, measures the text, and sets the block size to match the content size.

<snippet id='libraries-pdf-editing-block-measure-without-parameter'/>

{{region cs-radpdfprocessing-editing-block_7}}
Block block = new Block();
block.InsertText("Hello RadPdfProcessing!");
Size size = block.Measure();
{{endregion}}
#### Example 8 Result
![Rad Pdf Processing Measuring Block 01](images/RadPdfProcessing_Measuring_Block_01.png)

The second overload accepts available __Size__. Calling it measures the block content as if the __Block__ was in that specific size.
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.

__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.

<snippet id='libraries-pdf-editing-block-measure-with-parameter'/>

#### Example 9 Result
![Rad Pdf Processing Measuring Block 02](images/RadPdfProcessing_Measuring_Block_02.png)

## Splitting a Block

Expand Down Expand Up @@ -267,3 +290,4 @@ The code in __Example 9__ splits a block in two. The first will contains text "H
* [Text and Graphic Properties]({%slug radpdfprocessing-editing-text-and-graphic-properties%})
* [How to Measure Text in WordsProcessing .NET Framework]({%slug wordsprocessing-measure-text-netframework%})
* [How to Measure Text in WordsProcessing .NET Standard]({%slug wordsprocessing-measure-text-netstandard%})
* [How to Generate a PDF Document from Images with FixedContentEditor]({%slug pdf-from-images-with-fixedcontenteditor%})
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,16 @@ __Example 1__ shows how to use __TextFormatProvider__ to export __RadFixedDocume
#### __[C#] Example 1: Export RadFixedDocument to string__

{{region cs-radpdfprocessing-formats-and-conversion-plain-text-textformatprovider_0}}
Telerik.Windows.Documents.Fixed.FormatProviders.Text.TextFormatProvider provider = new Telerik.Windows.Documents.Fixed.FormatProviders.Text.TextFormatProvider();
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.
string documentContent = provider.Export(document);
Telerik.Windows.Documents.Fixed.FormatProviders.Text.TextFormatProvider textFormatProvider = new Telerik.Windows.Documents.Fixed.FormatProviders.Text.TextFormatProvider();

RadFixedDocument document = new RadFixedDocument();
using (RadFixedDocumentEditor radFixedDocumentEditor = new RadFixedDocumentEditor(document))
{
radFixedDocumentEditor.InsertLine("Sample line.");
radFixedDocumentEditor.InsertRun("Sample run.");
}

string documentAsText = textFormatProvider.Export(document);
{{endregion}}


Expand Down
2 changes: 1 addition & 1 deletion libraries/radpdfprocessing/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Exporting to PDF format can be achieved with the __PdfFormatProvider__ class. __
}
{{endregion}}


For more complete examples head to the [Developer Focused Examples]({%slug radpdfprocessing-sdk-examples%}) section of the library.

## See Also

Expand Down
2 changes: 2 additions & 0 deletions libraries/radspreadprocessing/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ For more examples and application scenarios of Importing and Exporting a Workboo

>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%}).

For more complete examples head to the [Developer Focused Examples]({%slug radspreadprocessing-sdk-examples%}) section of the library.

## Using RadSpreadsheet

__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__.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Accessing Cells of a Worksheet
page_title: Accessing Cells of a Worksheet
slug: radspreadprocessing-working-with-cells-accessing-cells-of-worksheet
tags: accessing,cells,of,a,worksheet
tags: accessing,cells,worksheet,cellselection,workbook,xlsx,spreadprocessing,
published: True
position: 2
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Get, Set and Clear Cell Properties
page_title: Get, Set and Clear Cell Properties
slug: radspreadprocessing-working-with-cells-get-set-clear-properties
tags: get,,set,and,clear,cell,properties
tags: get,set,and,clear,cell,properties,cellselection,spreadprocessing
published: True
position: 4
---
Expand Down Expand Up @@ -50,10 +50,10 @@ Once you have a __CellSelection__ instance, you can easily set and retrieve the
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:


* __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.
* __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.


* __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.
* __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.


## Cell Properties
Expand Down Expand Up @@ -142,7 +142,7 @@ __Example 3__ illustrates who to retrieve the value of cell B2.



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.
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.


__Example 4__ demonstrates how to set the value of a given selection.
Expand Down Expand Up @@ -268,7 +268,7 @@ The result of __Example 7__ is illustrated in __Figure 3__.

## Indent Property

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.
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.


#### __[C#] Example 8: Increase and decrease indent__
Expand All @@ -285,7 +285,7 @@ In addition to the __GetIndent()__, __SetIndent()__ and __ClearIndent()__ method


## See Also

* [Accessing Cells of a Worksheet - CellSelection] ({%slug radspreadprocessing-working-with-cells-accessing-cells-of-worksheet%})
* [Cell Value Types]({%slug radspreadprocessing-working-with-cells-cell-value-types%})
* [PatternType Enumeration](https://docs.telerik.com/devtools/document-processing/api/Telerik.Windows.Documents.Spreadsheet.Model.PatternType.html)
* [GradientType Enumeration](https://docs.telerik.com/devtools/document-processing/api/Telerik.Windows.Documents.Spreadsheet.Model.GradientType.html)
2 changes: 1 addition & 1 deletion libraries/radspreadstreamprocessing/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ When reading a document with **RadSpreadStreаmProcessing**, the order of parsin

{{endregion}}


For more complete examples head to the [Developer Focused Examples]({%slug radspreadstreamprocessing-sdk-examples%}) section of the library.

## See Also

Expand Down
27 changes: 17 additions & 10 deletions libraries/radwordsprocessing/editing/clone-and-merge.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,20 @@ __RadWordsProcessing__ allows you to merge two __RadFlowDocument__ instance usin

#### __[C#] Example 1: Merge two instances of RadFlowDocument__

{{region cs-radwordsprocessing-editing-clone-and-merge_0}}

RadFlowDocument target = new RadFlowDocument();
RadFlowDocument source = new RadFlowDocument();
//...
// target will contain merged content and styles.
target.Merge(source);
{{region cs-radwordsprocessing-editing-clone-and-merge_0}}
RadFlowDocument targetDocument;
RadFlowDocument sourceDocument;

DocxFormatProvider docxFormatProvider = new DocxFormatProvider();

byte[] targetByteArray = File.ReadAllBytes("targetDocument.docx");
byte[] sourceByteArray = File.ReadAllBytes("sourceDocument.docx");

targetDocument = docxFormatProvider.Import(targetByteArray);
sourceDocument = docxFormatProvider.Import(sourceByteArray);

// targetDocument will contain merged content and styles.
targetDocument.Merge(sourceDocument);
{{endregion}}


Expand Down Expand Up @@ -61,14 +68,14 @@ __Example 2__ shows how to merge documents by specifying the __MergeOptions__ pa

{{region cs-radwordsprocessing-editing-clone-and-merge_1}}

RadFlowDocument target = new RadFlowDocument();
RadFlowDocument source = new RadFlowDocument();
RadFlowDocument targetDocument;
RadFlowDocument sourceDocument;
//...
MergeOptions mergeOptions = new MergeOptions()
{
ConflictingStylesResolutionMode = ConflictingStylesResolutionMode.RenameSourceStyle
};
target.Merge(source, mergeOptions);
targetDocument.Merge(sourceDocument, mergeOptions);
{{endregion}}


Expand Down
Loading