Telerik Forums
Telerik Document Processing Forum
1 answer
229 views

I'm struggling to see how to programmatically keep track of the relevant Y position to give to the FixedContentEditor after adding dynamically created elements such as tables and Text that can vary in height.

An example would be Drawing a Block that contains text from a SQL Query. This text could be one line long or 30 lines long and therefore the height of the text can vary greatly (below its in dtJobHeader.Rows(0).Item("Comment")). I need to be able to tell the editor.position.translate where it needs to move to and draw the next block after the previous block is drawn.

        editor.Position.Translate(defaultLeftIndent, currentTopOffset)
        editor.DrawBlock(DrawBlock(dtJobHeader.Rows(0).Item("Comment")), New Size(maxWidth, Double.PositiveInfinity))

        currentTopOffset += ????
        editor.Position.Translate(defaultLeftIndent, currentTopOffset)
        editor.DrawBlock(DrawBlock("Some Text Here, etc, etc, etc"), New Size(maxWidth, Double.PositiveInfinity))

Private Function DrawBlock(texttodraw As String) As Block

        Dim block As New Block()
        block.GraphicProperties.FillColor = RgbColors.Black
        block.HorizontalAlignment = HorizontalAlignment.Left
        block.TextProperties.Font = FontsRepository.Helvetica
        block.InsertText(texttodraw)

        Return block

 End Function


      

 

Martin Ivanov
Telerik team
 answered on 09 May 2017
4 answers
693 views

Hi, 

 

Is it possible to do the DOCX to PDF conversion? Because I have a document in a folder and I want to export to pdf.

 

Mihail
Telerik team
 answered on 09 May 2017
3 answers
685 views

How to align content in cell vertically?

cell.VerticalAlignment = Telerik.Windows.Documents.Flow.Model.Styles.VerticalAlignment.Center;

does not help me. Text is still align at top

cell = row.Cells.AddTableCell();
cell.VerticalAlignment = Telerik.Windows.Documents.Flow.Model.Styles.VerticalAlignment.Center;
cell.PreferredWidth = new TableWidthUnit(TableWidthUnitType.Percent, 15);
paragraph = cell.Blocks.AddParagraph();
run = paragraph.Inlines.AddRun();
run.Text = "Text in cell text in cell text in cell";
Tanya
Telerik team
 answered on 05 May 2017
1 answer
293 views

I'm trying to create a table and add strings to the cells in a RadFixedDocument as per the c# example here:

http://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/editing/table.html

table table = new Table();
TableRow row = table.Rows.AddTableRow();
row.Cells.AddTableCell().Blocks.AddBlock().InsertText("First cell");
row.Cells.AddTableCell().Blocks.AddBlock().InsertText("Second cell");

When I convert this to vb.net using your tool I get this:

Dim table As Telerik.Windows.Documents.Flow.Model.Table
Dim row As Telerik.Windows.Documents.Flow.Model.TableRow = table.Rows.AddTableRow()
row.Cells.AddTableCell().Blocks.AddBlock().InsertText("First cell")
row.Cells.AddTableCell().Blocks.AddBlock().InsertText("Second cell")

and get the following error:

AddBlock is not a member of BlockCollection

 

Could someone please attached a code snippet or demo showing how to create a PDF containing Tables with values in them but in VB.NET please.

(I am doing this in a AJAX web application Telerik R1 2017)

 

 

 

Jamie
Top achievements
Rank 1
 answered on 03 May 2017
6 answers
628 views
I do not know what the data going into the PDF will look like - and would like to be able to set Number and Date cells/columns to not wrap by default.  Is this possible?  
Deyan
Telerik team
 answered on 03 May 2017
7 answers
657 views
I am importing a DOCX but the header and footer is not appearing when exporting to PDF. Any ideas?
Mark
Top achievements
Rank 1
 answered on 26 Apr 2017
4 answers
231 views

The dynamic Word documents was created in ASP.net  and stream it through System.IO.MemoryStream.

I read the stream data from System.IO.MemoryStream and put it in a Zip file using Telerik Zip Archive Entry,

But the error of "The destination file could not be create" keeps popping out...please see my code below and

let me know what I missed....Please help me....thanks.

oResponse.Clear()
oResponse.AddHeader("content-disposition", "attachment; filename=Gerrytest4.zip")
oResponse.ContentType = "application/octet-stream"
Using memoryStream As New System.IO.MemoryStream
       Using archive As New ZipArchive(memoryStream, ZipArchiveMode.Create, True, Nothing)
              Using entry As ZipArchiveEntry = archive.CreateEntry(sSSPFilename)
                     Dim writer As New BinaryWriter(entry.Open())
                     oDocTemplate.Save(memoryStream, oFormat)
                     Dim sr As BinaryReader = New BinaryReader(memoryStream, System.Text.Encoding.UTF8)
                     memoryStream.Position = 0
                     writer.Write(sr.ReadBytes(memoryStream.Length))
                     writer.Flush()
             End Using
       End Using
      oResponse.BinaryWrite(memoryStream.ToArray())

End Using

 

Boby
Telerik team
 answered on 24 Apr 2017
12 answers
931 views

Hi Guys.

Im using the following to extract files to a new directory under windows 10.

Users do not have Admin rights

 

Dim NewDir As String = GetGUID

            System.IO.Directory.CreateDirectory(My.Computer.FileSystem.CombinePath(VADataCacheClass.VaTempStorage, NewDir))
            If System.IO.Directory.Exists(My.Computer.FileSystem.CombinePath(VADataCacheClass.VaTempStorage, NewDir)) Then
                Try
                    Telerik.WinControls.Zip.Extensions.ZipFile.ExtractToDirectory(ZipFile, My.Computer.FileSystem.CombinePath(VADataCacheClass.VaTempStorage, NewDir))
                    For Each f As String In My.Computer.FileSystem.GetFiles(My.Computer.FileSystem.CombinePath(VADataCacheClass.VaTempStorage, NewDir))
                        ImportCollection.Add(f)
                    Next
                Catch ex As Exception
                    MessageBox.Show(ex.ToString)
                End Try

                For Each f As String In My.Computer.FileSystem.GetFiles(My.Computer.FileSystem.CombinePath(VADataCacheClass.VaTempStorage, NewDir))
                    ImportCollection.Add(f)
                Next
            End If

 

Unfortunately the zip extract method always fails with an "Access denied" error message.

However the "for loop" which is designed to add the files extracted to a string collection has no problem reading any files in the directory

 

Is the some sort of write permission setting im missing in the Telerik.WinControls.Zip.Extensions.ZipFile.ExtractToDirectory method

Martin Ivanov
Telerik team
 answered on 31 Mar 2017
1 answer
276 views

Hello,

I'm creating a PDF document using the FixedContentEditor class. In this document, I've to put a lot of tables and I use the Measure() function to read the height of the last table inserted in order to move the current position (with editor.Position.Translate) and to start with a new table.

Unfortunately, I noticed that this works fine but if the table has multi rows texts in cells, the Measure function gives me the result as the cells had only singles row texts in the cells.

To add a cell with multi rows text I use the following code:

TableRow row = table.Rows.AddTableRow();
TableCell cell = row.Cells.AddTableCell();
Block block = cell.Blocks.AddBlock();
block.InsertText(font, FontStyles.Normal, FontWeights.Bold, "Details:");
cell = row.Cells.AddTableCell();
block = cell.Blocks.AddBlock();
foreach (string line in multirows_text.Split('\n'))
{
  block.InsertText(fontFamily, fontStyle, fontWeight, line);
  block.InsertLineBreak();
}

 

Then, I use the following code to get the table height:

table.Measure().Height

that gives me the same value both if the multirows_text string variable contains one or more lines of text

Is there another way to get the table height in case of tables with multiple lines of text cells?

Any help will be appreciated. Thanks in advance.

Giorgio

Martin Ivanov
Telerik team
 answered on 31 Mar 2017
2 answers
122 views

When I am trying to merge cells in a spreadsheet I get the error "The given key was not present in the dictionary.", I am able to merge cells accross columns on the same row using MergeAccross but I am unable to merge cells in the same column over multiple rows. I am not sure if this is a bug or if it just something I am doing. Any help would be appreciated.

For d As Integer = 0 To arrDate.GetUpperBound(0)
                               fromCellIndex = New CellIndex(5, d + 1)
                               toCellIndex = New CellIndex(10, d + 1)
                               xlWorkSheet.Cells(fromCellIndex, toCellIndex).Clear(ClearType.All)
                               nCellSelection = xlWorkSheet.Cells(fromCellIndex, toCellIndex)
                               nCellSelection.Merge()  <-- Line the error gets thrown.

next d

 

Tanya
Telerik team
 answered on 30 Mar 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?