Telerik Forums
Telerik Document Processing Forum
2 answers
1.2K+ views

Hi folks,

In the code below, how do I set the text colour for text "INVOICE TO" (line 10) to gray? This is using RadFixedDocument.  

The Block object's TextProperties has a HighlightColor property but not a Color property.

As you can see in the code below, the block is inside a cell within a table row within a table.

Thanks for any pointers.

Ken

01.Table addressInfoTable = new Table();
02.addressInfoTable.LayoutType = TableLayoutType.FixedWidth;
03.TableRow infoToRow = addressInfoTable.Rows.AddTableRow();
04.TableCell infoToCell = infoToRow.Cells.AddTableCell();
05.infoToCell.PreferredWidth = 350;
06.Block infoBlock = infoToCell.Blocks.AddBlock();
07.infoBlock.HorizontalAlignment = HorizontalAlignment.Left;
08.//       infoBlock.TextProperties.HighlightColor = new RgbColor(0, 0, 255);
09.//       infoBlock.BackgroundColor = new RgbColor(255, 10, 10);
10.infoBlock.InsertText("INVOICE TO");
11.infoBlock.InsertLineBreak();
12.infoBlock.InsertText(invoice.Payer.FirstName() + " " + invoice.Payer.LastName());
13.infoBlock.InsertLineBreak();
kencox
Top achievements
Rank 1
 answered on 18 Apr 2018
11 answers
1.4K+ views
Hello to all,
I have a DOCX file with a header logo.
I import the file in a RadFlowDocument and edit it with a RadFlowDocumentEditor.
If I save it in a new DOCX everything it is OK.
If I save a PDF (with Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider) the image disappears.

The image in my DOCX is "in line".
So I think I should not convert images to "ImageInline", right?
If so, why have not the class Telerik.Windows.Documents.Model.ImageInline?
My Telerik version is 2016.2.607.

Thank you
Deyan
Telerik team
 answered on 16 Apr 2018
1 answer
268 views

Hello,

I would like to create a few different pdf-layers during pdf export.

Is it possible to create pdf-layers with PdfProcessing?

sample screen below in attachment:

best regards

Pawel

 

Tanya
Telerik team
 answered on 13 Apr 2018
1 answer
383 views

Hi guys,

I'm trying to add an ImageInLine into header (a classical Logo Company).

I would keep aspect ratio of my bitmap, but after export to word, it takes not effects.

I tryed to change PreferRelativeToOriginalResize to true and to false, when I try to open properties of image (into generated word file), I found this propertiy correctly changed.

But if I try to do same approach with LockAspectRatio to true and to false, It's ever false. Why?

This is my code to test.

I attached 4 test bitmap, 2 for PreferRelativeToOriginalResize (correctly results) and 2 for LockAspectRatio (wrong results)

editor.Document.HasDifferentEvenOddPageHeadersFooters = false;
var header = editor.Document.Sections.First().Headers.Add();
 
var image = header.Blocks.AddParagraph().Inlines.AddImageInline();
using (FileStream fs = File.Open(@"Resources\mylogo.jpg", FileMode.Open))
{
    image.Image.ImageSource = new Telerik.Windows.Documents.Media.ImageSource(fs, ".jpg");
    //image.Image.PreferRelativeToOriginalResize = false;
    image.Image.LockAspectRatio = true;
    //image.Image.SetWidth(true, 40);
}
Tanya
Telerik team
 answered on 12 Apr 2018
1 answer
275 views
Is there something special I need to keep in mind when converting Docx with images to a PDF? I tried to use the demo and my docx that had an image converted but the resulting pdf did not include the image.
Tanya
Telerik team
 answered on 06 Apr 2018
4 answers
578 views

How to get the text of BookMarks into a string variable. Following is my code.

#region Get Book Mark Data
        public void GetTextFromBookMarks(RadFlowDocument document)
        {
            IEnumerable<BookmarkRangeStart> bookmarkStart = document.EnumerateChildrenOfType<BookmarkRangeStart>();
            IEnumerable<BookmarkRangeEnd> bookmarkEnd = document.EnumerateChildrenOfType<BookmarkRangeEnd>();

            foreach (var item in bookmarkStart)
            {

            }

        }
        #endregion

Tanya
Telerik team
 answered on 03 Apr 2018
3 answers
2.5K+ views

Hello,

Could you please provide me an example or redirect me to a demo where pdf is created from stratch and/or pdf exported from the html input. We currently convert data populated WebForm pages into PDF files all on the server that are never delivered to a user via browser interaction, or even requested by a browser (automated generation.). Aside from an HTML source being easier to use and maintain, it would plug right into our existing situation and not require use to reconstruct our forms in C#. 

Thanks.

Tanya
Telerik team
 answered on 29 Mar 2018
1 answer
355 views

 

In my docx document I have a bookmark named: "SomeBookMark". "SomeBookMark" was created in msword while "SomeText" was selected.

In the telerik flowdocuments this would mean that BookmarkRangeStart would be placed before "SomeText" and BookmarkRangeEnd would be placed at the end of "SomeText".

 

I'm able to delete the bookmark and I am able to insert text before or after "SomeText". But effectively I would like to remove "SomeText" and insert my own text. I can see the text in the "inlines" of the paragraph that contains the bookmarks and the text but the way the inlines are populated depends heavily on how the word document was edited. From the word document it would look like "SomeText" was 1 inline entry but it might actually be more than 1. 

 

Is there any generic way to use the bookmarks to select the range of text between the start and end and replace or delete it?

Tanya
Telerik team
 answered on 28 Mar 2018
6 answers
1.0K+ views

when I import an Excel-Sheet with formulas,

in very simple cases,it converts correctly into a FormulaValueCell, gives me the formula and the GetResultValueAsString() gives the computed Value.

But with more complicated formulas, this doesn't seem to work.

 

 var value = sheet.Cells[6, 2].GetValue();
 var a = value.Value.GetResultValueAsString(CellValueFormat.GeneralFormat);
 var b = value.Value.GetValueAsString(CellValueFormat.GeneralFormat);
 var c = value.Value.RawValue;
 var d = value.Value.ValueType;

 

a"='[2]Übernahme 11-12'!C7"
b"='[2]Übernahme 11-12'!C7"
c"='[2]Übernahme 11-12'!C7"
d = Text

 

So first, it's generally wrong to consider this a text-cell

Second, in the xlsx File, there is a <v> Tag for each cell, containing the actual (numeric) value of a cell, even of formula cells.

Is there a way to access this computed value ? I can find the <v>100</v> Tag in the xlsx-File, but I don't find a way to access it.

Tanya
Telerik team
 answered on 28 Mar 2018
1 answer
403 views

How should I dispose the target object?

The file is kept locked...and cannot be accessed later by other code.

 Dim fileName As String = Server.MapPath("~/userfiles/file/excel/" & Session.SessionID & ".xlsx")

            Dim formatProvider As IWorkbookFormatProvider = New XlsxFormatProvider()

            Using output As New FileStream(fileName, FileMode.Create)
                formatProvider.Export(workbook, output)
            End Using

Anna
Telerik team
 answered on 26 Mar 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?