Telerik Forums
Telerik Document Processing Forum
1 answer
395 views

First I create the table by editor like this

RadFlowDocument tableDoc = new RadFlowDocument();
RadFlowDocumentEditor editor = new RadFlowDocumentEditor(tableDoc);
Telerik.Windows.Documents.Flow.Model.Table newTable = editor.InsertTable(1, 2);

     newTable.Rows[0].Cells[0].Borders = new TableCellBorders(
               new Telerik.Windows.Documents.Flow.Model.Styles.Border(1, Telerik.Windows.Documents.Flow.Model.Styles.BorderStyle.Single, ThemableColor.FromArgb(100, 0, 100, 0)),
               new Telerik.Windows.Documents.Flow.Model.Styles.Border(1, Telerik.Windows.Documents.Flow.Model.Styles.BorderStyle.None, ThemableColor.FromArgb(100, 0, 100, 0)),
               new Telerik.Windows.Documents.Flow.Model.Styles.Border(1, Telerik.Windows.Documents.Flow.Model.Styles.BorderStyle.Single, ThemableColor.FromArgb(100, 0, 100, 0)),
               new Telerik.Windows.Documents.Flow.Model.Styles.Border(1, Telerik.Windows.Documents.Flow.Model.Styles.BorderStyle.Single, ThemableColor.FromArgb(100, 0, 100, 0)));

 and prepare  the html string (with convert function) like this

string html = "<p>HTML STR   1234<span style=\"line-height:20px;\">1234   1234  </span></p>";
           HtmlFormatProvider providerHtml = new HtmlFormatProvider();
           RadFlowDocument document = providerHtml.Import(html); 

but I don't know how to put " RadFlowDocument " into table I 'm already try this but it show some error "The document element is associated with another document.
Parameter name: item"  . Please Help!!

Paragraph paragraph = new Paragraph(document);
 newTable.Rows[0].Cells[0].Blocks.Insert(0, paragraph);


 

 

 

 

 

 

Todor
Telerik team
 answered on 23 Dec 2015
1 answer
418 views

I use there code to make a docx file

 

RadFlowDocument document = new RadFlowDocument();
RadFlowDocumentEditor editor = new RadFlowDocumentEditor(document);
editor = new RadFlowDocumentEditor(document);
 
editor.insertText("this is page 1 ");
 
// but the problem is I want to insert text in another A4 page like
 
editor.insertText("this is page 2 ");

According to the document telerik I found that we can set up "section" for A4 page 

http://docs.telerik.com/devtools/aspnet-ajax/controls/wordsprocessing/model/section#rotating-a-section

but I think I don't understand how to use it please help !!
Section section = new Telerik.Windows.Documents.Flow.Model.Section(document);
         document.Sections.Add(section);
 
         section.PageMargins = new Telerik.Windows.Documents.Primitives.Padding(40, 10, 40, 10);
         section.PageSize = PaperTypeConverter.ToSize(PaperTypes.A4);//WindowsBase assembly should be referenced.
          
         editor.InsertSection();
         editor.InsertText(("Page 2 !!"));

 

and is it possible that we know what is the current page number before "insertText" ?

Tanya
Telerik team
 answered on 23 Dec 2015
1 answer
989 views

Hello

     I have a form in a windows application. The form contains grids, table, images, other data and a link called PDF generate. What is the best way to generate a pdf with the same format on the form with all the data using telerik controls?

 

David
Top achievements
Rank 1
 answered on 21 Dec 2015
1 answer
204 views

Hi all,

I've an Excel template with table objects (Ribbon Insert/Table). Is it possible with SpreadProcessing to get this object (by name) and fill it with data? Thanks a lot for your help.

Kind regards
Christian

 

Tanya
Telerik team
 answered on 03 Dec 2015
2 answers
157 views

Hi, 

I`m playing with Excel export task using SpreadProcessing.

I`ve notice that when i`m using merge for cellSelection - time needed to write to workbook increases dramatically. 

I made simple test -  cycle with 10000 inserts operations and merges of two cells (horizontal merge).

The results for cycle:

- with merge takes 00:00:06.3593555

- without merge takes 00:00:00.1815065

 My code:

var workbook = CreateWorkbook();
 workbook.History.IsEnabled = false;
workbook.SuspendLayoutUpdate();           
var worksheet = workbook.ActiveWorksheet;          
for (int i = 0; i < 10000; i++)
{
    CellIndex cellIndex = new CellIndex(i, 0);
    worksheet.Cells[cellIndex].SetValue("Data " + i);
    worksheet.Cells[cellIndex].SetHorizontalAlignment(RadHorizontalAlignment.Left);
    worksheet.Cells[i, 0, i, 2].MergeAcross();
}
workbook.ResumeLayoutUpdate();
workbook.History.IsEnabled = true;

Although, I made test with merge from 0 to 8 column. Result - 00:00:15.4579052.

Is there any workaround of such perfomance issue? 

 

Ars
Top achievements
Rank 1
 answered on 24 Nov 2015
2 answers
322 views

A web based application, I am working on, must provide users with the ability to export a collection of articles to one single PDF document. This articles contain HTML code for formatting the text as well as positioning of various parts of the article.

Below is the code which I came up with for Exporting one single article:

 

var html = File.OpenText(artPath).ReadToEnd();
var buffer = new byte[0];

var pdfProvider = new PdfFormatProvider();
var htmlFormatProvider = new HtmlFormatProvider();

HtmlImportSettings importSettings = new HtmlImportSettings();
importSettings.UseHtmlHeadingStyles = true;

htmlFormatProvider.ImportSettings = importSettings;

var document = htmlFormatProvider.Import(html);
document.LayoutMode = DocumentLayoutMode.Paged;
document.EnsureDocumentMeasuredAndArranged();

buffer = pdfProvider.Export(document);

using (var fs = new FileStream(pdfDocPath, FileMode.Create, FileAccess.Write, FileShare.Read))
{
fs.Write(buffer, 0, buffer.Length);
fs.Flush();
}

 

However, I am not being able to figure out how to export multiple articles into one single PDF document. Any help would be highly appreciated.

 

Thanks!

Zen

Zen
Top achievements
Rank 1
 answered on 18 Nov 2015
1 answer
124 views

Hi,

I am using RadDocument. When user double clicks on the header section, the caret goes to header section. Is there anyway for me to find out if my caret is in header/footer section or in the document body section?

 

Kind Regards,

 Shahed

 

Todor
Telerik team
 answered on 17 Nov 2015
1 answer
589 views

Is there any way to zip a folder with all sub-folders included?

I can go through each subdirectory and zip its contents - but it doesn't keep the directory structure, and results in all files (from each sub folder) in the one directory

Any help appreciated

 

Michael

Nikolay Demirev
Telerik team
 answered on 13 Nov 2015
1 answer
129 views

Hello,

' The Telerik document processing libraries support .NET Framework versions 4.0 and above. As of Q3 2014 the RadEditor export/import to RTF is not supported under .NET 3.5 '

 

How can I create a Word document with .NET 3.5?

Ianko
Telerik team
 answered on 11 Nov 2015
2 answers
477 views

Hello everybody

 I have a problem with pdf file loading into PdfDocumentSource.

In the OnException handler I have next information:
Value cannot be null.
Parameter name: Pages

   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider.Import()
   at Telerik.Windows.Documents.Fixed.PdfDocumentSource.CreateDocumentFromStreamOverride(Stream stream, FormatProviderSettings settings)
   at Telerik.Windows.Documents.Fixed.FixedDocumentStreamSource.CreateDocumentFromStream(Stream stream, FormatProviderSettings settings)

This file is a scan of a document and has one page. I can open it in PDF readers.
Unfortunately ​I can't attach the file because it's confidential (and I don't have such problem with any other file).

Here is it's header and ending:
header:
%PDF-1.3
1 0 obj
<</Type /XObject /Subtype /Image /Name /Im1 /Width 1654 /Height 2338 /Length 315069/ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter [ /DCTDecode ] >> stream

-------------------------------------------------------------------------------------------------------------------------
ending:

endobj
2 0 obj
<< /Length 47 
>>
stream
q 595.44 0 0 841.68 0.00 0.00 cm 1 g /Im1 Do Q
endstream
endobj
3 0 obj
<<
/Type /Page
/MediaBox [0 0 596 842]
/Parent 4 0 R 
/Rotate 0 /Resources <<
/ProcSet [/PDF /ImageC /ImageB /ImageI]
/XObject <<
/Im1 1 0 R
 >>
 >>
/Contents [ 2 0 R
]
>>
endobj
4 0 obj
<<
/Type /Pages
/Kids [ 3 0 R]
/Count 1
>>
endobj
5 0 obj
<<
/Type /Catalog
/Pages 4 0 R  
>>
endobj
6 0 obj
<< /Creator ()
/CreationDate ()
/Author ()
/Producer ()
/Title ()
/Subject ()
>>
endobj
xref
1 7
0000000000 65535 f 
0000000009 00000 n 
0000315262 00000 n 
0000315359 00000 n 
0000315546 00000 n 
0000315604 00000 n 
0000315655 00000 n 
trailer
<<
/Size 7
/Root 5 0 R
/Info 6 0 R
>>
startxref
315751
%%EOF

 

Is there any possibility to load this document source?

 

Thanks,

Dzmitry

Dzmitry
Top achievements
Rank 1
 answered on 06 Nov 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?