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
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.
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";
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)
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
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
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
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