Telerik Forums
Telerik Document Processing Forum
3 answers
234 views
Trying to create pdf to print address labels on existing 3 column Avery 8460 form. I am using Telerik.Windows.Documents.Fixed.Model.RadFixedDocument and RadFixedDocumentEditor with Telerik.Windows.Documents.Fixed.Model.Editing.Tables.Table but can't get everything to line up. I'm thinking using Block with position and size would be better. Can anyone point me in the right direction? ASP.NET C# Any examples out there? Thanks Fred
Tanya
Telerik team
 answered on 13 Jun 2019
1 answer
909 views

Hi all, 

I'm using RadPdfProcessing for ASP.NET MVC to create pdf template for financial documents. Sometimes content of some tables can be various length. In this case I'd like to move lower blocks/tables to a new page and generate pdf document with two pages. I'm using RadFixedDocument and FixedContentEditor to create tables/blocks on the document.  Piece of ode below:

  public static RadFixedDocument CreateDocument()
{
      RadFixedDocument document = new RadFixedDocument();
      RadFixedPage page = new RadFixedPage();          
       page.Size = new Size(600, 750);           
             
      FixedContentEditor editor = new FixedContentEditor(page);
      document.Pages.Add(page);
 
      editor.Position.Translate(defaultLeftIndent + 330, defaultTopIndent);
            DrawTable(editor, maxWidth);
 
            editor.Position.Translate(defaultLeftIndent, defaultTopIndent + 70);
            DrawTitle(editor, maxWidth);
 
            editor.Position.Translate(defaultLeftIndent, defaultTopIndent + 110);
            DrawTableWithDetails(editor, maxWidth);
            
            editor.Position.Translate(defaultLeftIndent, defaultTopIndent + 220);
            DrawReceiverTable(editor, maxWidth);
         
             private static void DrawTable(FixedContentEditor editor, double maxWidth)
        {
            Table table = new Table();
            table.LayoutType = TableLayoutType.AutoFit;
            table.DefaultCellProperties.Padding = new Thickness(1);
 
            #region FIRST ROW
            TableRow firstRow = table.Rows.AddTableRow();
            TableCell firstCell = firstRow.Cells.AddTableCell();
            Block firstBlock = firstCell.Blocks.AddBlock();
            firstBlock.TextProperties.FontSize = 10;
            firstBlock.TextProperties.Font = FontsRepository.Helvetica;
            firstBlock.InsertText("xxxxxxxxx");
 
            TableCell secondCell = firstRow.Cells.AddTableCell();
            Block secondBlock = secondCell.Blocks.AddBlock();
            secondBlock.TextProperties.FontSize = 10;
            secondBlock.TextProperties.Font = FontsRepository.Helvetica;
            secondBlock.InsertText(" xxxxxxxxx");
            #endregion
            editor.DrawTable(table, new Size(maxWidth, double.PositiveInfinity));
 
        }
 
        private static void DrawTitle(FixedContentEditor editor, double maxWidth)
        {
            Block block = new Block();
            block.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Center;
            block.TextProperties.Font = FontsRepository.HelveticaBold;
            block.TextProperties.FontSize = 16;
            block.InsertText("xxxxxxxxx");
            block.InsertText("<xxxxxxxxx>");
            editor.DrawBlock(block, new Size(maxWidth, double.PositiveInfinity));
        }
 
        private static void DrawTableWithDetails(FixedContentEditor editor, double maxWidth)
        {
            Table table = new Table();
            table.LayoutType = TableLayoutType.FixedWidth;
            table.DefaultCellProperties.Padding = new Thickness(1);
            Border border = new Border();
            Border whiteBorder = new Border(0, BorderStyle.None, new RgbColor(255, 255, 255));
            table.DefaultCellProperties.Borders = new TableCellBorders(border, border, border, border);
            #region FIRST ROW
            TableRow firstRow = table.Rows.AddTableRow();
            TableCell firstCell = firstRow.Cells.AddTableCell();
            Block firstBlock = firstCell.Blocks.AddBlock();
            firstBlock.TextProperties.Font = FontsRepository.HelveticaBold;
            firstBlock.InsertText("xxxxxxxxx");
            TableCell secondCell = firstRow.Cells.AddTableCell();
            Block secondBlock = secondCell.Blocks.AddBlock();
            secondBlock.TextProperties.Font = FontsRepository.HelveticaBold;
            secondBlock.InsertText("xxxxxxxxx");
            #endregion
            #region SECOND ROW
            TableRow secondRow = table.Rows.AddTableRow();
            firstCell = secondRow.Cells.AddTableCell();
            firstCell.Borders = new TableCellBorders(border, border, border, whiteBorder);
            firstBlock = firstCell.Blocks.AddBlock();
            firstBlock.TextProperties.FontSize = 10;
            firstBlock.InsertText("xxxxxxxxx");
            secondCell = secondRow.Cells.AddTableCell();
            secondCell.Borders = new TableCellBorders(border, border, border, whiteBorder);
            secondBlock = secondCell.Blocks.AddBlock();
            secondBlock.TextProperties.FontSize = 10;
            secondBlock.InsertText("xxxxxxxxx");
            #endregion
            editor.DrawTable(table, new Size(maxWidth, double.PositiveInfinity));
        }
 
        private static void DrawReceiverTable(FixedContentEditor editor, double maxWidth)
        {
            Table table = new Table();
            table.LayoutType = TableLayoutType.FixedWidth;
            table.DefaultCellProperties.Padding = new Thickness(1);
            Border border = new Border();
            Border whiteBorder = new Border(0, BorderStyle.None, new RgbColor(255, 255, 255));
            table.DefaultCellProperties.Borders = new TableCellBorders(border, border, border, border);
            #region TABLE CONTENT
            TableRow firstRow = table.Rows.AddTableRow();
            TableCell firstCell = firstRow.Cells.AddTableCell();
            Block firstBlock = firstCell.Blocks.AddBlock();
            firstBlock.TextProperties.Font = FontsRepository.HelveticaBold;
            firstBlock.InsertText("xxxxxxxxx");
 
            TableRow secondRow = table.Rows.AddTableRow();
            firstCell = secondRow.Cells.AddTableCell();
            firstCell.Borders = new TableCellBorders(border, border, border, whiteBorder);
            firstBlock = firstCell.Blocks.AddBlock();
            firstBlock.TextProperties.FontSize = 10;
            firstBlock.InsertText("xxxxxxxxx");
            #endregion
            editor.DrawBlock(table, new Size(maxWidth, double.PositiveInfinity));
        }
}
Nikolay Demirev
Telerik team
 answered on 13 Jun 2019
3 answers
397 views

I've recently been given the task of turning some labels that we use to put on hardcopy documents into format that can be printed with a small label printer that takes 62mm label tape.

Basically, the user types all the data for the label into a form. I then store the details for them in a grid. When they are ready to print the label, they click a print button that is in my grid. The data for the label is put into a pdf and they print it from the pdf.

The label printer uses a continuous roll or tape so that the text fields can be as long as they want. I'm currently putting all the details into a Table object and then I draw the table with a width of 62mm.

How can I find what the height of the table would be when the width is 62mm so that I can set the height of the page?

 

public RadFixedDocument CreateDocument()
        {
            RadFixedDocument document = new RadFixedDocument();
            RadFixedPage page = document.Pages.AddPage();
            page.Size = new Size(Telerik.Windows.Documents.Media.Unit.MmToDip(62), Telerik.Windows.Documents.Media.Unit.MmToDip(100));
            FixedContentEditor editor = new FixedContentEditor(page);

            Table table = CreateDetailsTable();
                        
            editor.DrawTable(table, Telerik.Windows.Documents.Media.Unit.MmToDip(62));

            return document;
        }

Georgi
Telerik team
 answered on 11 Jun 2019
9 answers
721 views
I am currently working on a task to export records from to excel file for a client in an . I want to know the maximum number of records and number of columns that can be exported using library. And I would also like to know the limitations of using this library for exporting large files with 3 to 5 lakhs of records.
Richard
Top achievements
Rank 1
 answered on 08 Jun 2019
1 answer
81 views

 

   Hi,

    Is there a way to set background for IRowExporter like set color for ICellExporter,seems we only can loop all cells in a row and set one by one now ?

 

   thank you !

 

  

Tanya
Telerik team
 answered on 05 Jun 2019
1 answer
362 views

currently ,we can set fore color for cell ,like 

ICellExporter cellExporter = rowExporter.CreateCellExporter()

var color = System.Drawing.ColorTranslator.FromHtml("#0095ff");
cellExporter.SetFormat(new SpreadCellFormat() { ForeColor = new SpreadThemableColor(new SpreadColor(color.R, color.G, color.B))} );

 

but how to set background color for cell,i searched API but find nothing,anyone good idea?

 

thank you 

Tanya
Telerik team
 answered on 31 May 2019
3 answers
136 views

Hello,

I am trying to create Word document from scratch.  I prepared a asp.net webforms application and got a System DataTable 

How do I insert a table from a datatable using Telerik RadWordsProcessing?

Thank you

Tanya
Telerik team
 answered on 30 May 2019
1 answer
257 views

First cell of table should not allow wrapping but always does. Does it have anything to do with the fact that I'm using a flow document instead of fixed? There seems to be very little documentation or samples of flow documents.

 

public void Mvce()
{
    Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider provider = new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();
 
    RadFlowDocument document = new RadFlowDocument();
    RadFlowDocumentEditor editor = new RadFlowDocumentEditor(document);
 
    Table t = editor.InsertTable();
 
    TableCell cell0 = new TableCell(document);
    cell0.CanWrapContent = false;
 
    //AddBlock() not available??? Its in the documentation:
    cell0.Blocks.AddParagraph().Inlines.AddRun("ClientName:");
 
    TableCell cellLong = new TableCell(document);
    cellLong.Blocks.AddParagraph().Inlines.AddRun("Nullam sit amet dui porta, imperdiet quam sit amet, consequat diam. In vel orci rutrum, vehicula purus ullamcorper, ornare lorem. Sed at arcu ultrices, fringilla augue in, condimentum quam. Sed pretium faucibus");
 
    var row = t.Rows.AddTableRow();
    row.Cells.Add(cell0);
    row.Cells.Add(cellLong);
 
    using (Stream output = File.OpenWrite("sample.pdf"))
    {
        provider.Export(document, output);
    }
    Process.Start("sample.pdf");
}

 

Tanya
Telerik team
 answered on 17 May 2019
1 answer
112 views

Hi,

In my MVC project, we used custom-server-side code to export grid data to Excel by utilizing Telerik.Document.SpreadsheedStreaming library.  I explore Processing Document and didn’t find any interface related adding filter  and frozen row to the sheet. Do I have the way to do the job?  Any suggestion will be truly appreciated!  

Tanya
Telerik team
 answered on 16 May 2019
2 answers
1.1K+ views

I am trying to print existing pdfs from a database.    I am working mainly in asp.net expecting the print to happen on the server.  This works for other types of files and I also use Telerik reporting which automatically prints reports on the server.   The problem is what do I use to open an existing pdf and then send it to a printer without user interface.

Peshito
Telerik team
 answered on 16 May 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?