Telerik Forums
Telerik Document Processing Forum
1 answer
533 views

When I create a `TableCell` in a flow document it is has a left & right padding of ~7.  How can I change the default padding?

I assume styles, right?  https://docs.telerik.com/devtools/document-processing/libraries/radwordsprocessing/concepts/styles

I tried changing the padding but it says there's only a getter: `tableStyle.TableCellProperties.Padding = new Padding(0)`

Dimitar
Telerik team
 answered on 22 Jul 2020
2 answers
579 views

I'm creating a Pdf document several pages long with several tables of varying heights. All of the tables are small enough to fit on a single page. If I just add the tables one after another, some will be split on more than one page. Is it possible to track the current y position on a page and add a page break if a table would be split onto a new page?

Thanks,

 

Tim

Tim
Top achievements
Rank 3
Iron
Iron
Iron
 answered on 14 Jul 2020
5 answers
571 views

Hi all!

I'm using the latest version of Xamarin.Documents.Fixed from NuGet (2020.2.615) and I'm trying to create a PDF in a Xamarin.Forms application using RadFixedDocument. Everything works fine except I cannot insert the degree symbol in the document.

This is my code:

var valueCell = row.Cells.AddTableCell(); //row is a TableRow
var valueCellBlock = valueCell.Blocks.AddBlock();            
valueCellBlock.InsertText("36 °C");

The resulting document contains the text "36 C", without the ° symbol.

So, how should I pass the degree symbol in order to include it in the document?

Kindest regards.

Martin
Telerik team
 answered on 14 Jul 2020
6 answers
2.3K+ views
Hi support,

I'm trying to set the width to 4 columns in a new spreadsheet but it doesn't work the way I expect.

Here's is the code

01.Workbook workbook = new Workbook();
02.Worksheet worksheet = workbook.Worksheets.Add();
03. 
04.worksheet.Columns[1].SetWidth(new ColumnWidth(8.11, true));
05.worksheet.Columns[2].SetWidth(new ColumnWidth(33.78, true));
06.worksheet.Columns[3].SetWidth(new ColumnWidth(60.67, true));
07.worksheet.Columns[4].SetWidth(new ColumnWidth(7.67, true));
08. 
09.IWorkbookFormatProvider formatProvider = new Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsx.XlsxFormatProvider();
10. 
11.using (Stream output = new FileStream(fileName, FileMode.Create))
12.{
13.    formatProvider.Export(workbook, output);
14.}

When I check the size of each column in the exported file this is what I get:

column 1: 0.63 (10 pixels)
column 2: 4.00 (43 pixels)
column 3: 7.89 (78 pixels)
column 4: 0.63 (10 pixels)

and what I need is:

column 1: 8.11  (80 pixels)
column 2: 33.78 (311 pixels)
column 3: 60.67 (553 pixels)
column 4: 7.67  (76 pixels)

You can see the screenshot I attached.

How can I get the exact size I'm specifying?

Thank you,

PD: I'm using version Telerik 2019.1.114.40

Arben
Top achievements
Rank 1
 answered on 08 Jul 2020
8 answers
1.3K+ views

Are you able to open a DOCX and return the text from the document into a string. I need to be able to parse through the string to determine text replacements to be made. I can see methods for replacing text, but not for determining what text a document contains

Regards

Tanya
Telerik team
 answered on 30 Jun 2020
1 answer
5.4K+ views
Hello,

Our MVC/Kendo project utilized Telerik.Documents.SpreadsheetStreaming library to export data to Excel file. Now we'd like to do reverse process - IMPORT process which read data from physical location (through file system or from database) to C# object. I didn't find related Interface or method in Telerik.Documents.SpreadsheetStreaming. Could someone point out which library is the better way to do so. Thanks  in advance!
Martin
Telerik team
 answered on 29 Jun 2020
2 answers
647 views

Hi

I'm trying to create report as a PDF file and the report might have several PDF documents as appendixes. 

01.
02.RadFixedDocument reportPdf = CreateReportPdf();
03.foreach(RadFixedDocument appendixPdf = appendixes)
04.{
05.  // here I would like to scale appendixPdf to 80% of reportPdf.
06.  // Then I would like to add some header/footer telling which appendix file that has been added
07.  reportPdf.merge(appendixPdf);
08.}
09.return reportPdf;

 

I hope the above example gives an idea on what I'm trying to do. Hope somebody can give some inspiration on how to accomplish it.

 

Yours
/peter

Peter
Top achievements
Rank 1
 answered on 12 Jun 2020
6 answers
1.6K+ views

Hi! I'm generating an Excel document containing various fonts of "HelveticaNeue". Please see attached images for samples.

When exporting to pdf using PdfFormatProvider, the font styles are changed, e.g. bold style disappears. However, when exporting using Excel interops it works.

Code using interops:

public static void ExcelToPdf( string xlFilePath, string pdfOutputPath )
{
    try
    {
        Excel.Application app = new Excel.Application();
        app.Visible = false;
        app.DisplayAlerts = false;
        Excel.Workbook wkb = app.Workbooks.Open( xlFilePath, ReadOnly: true );
        wkb.ExportAsFixedFormat( Excel.XlFixedFormatType.xlTypePDF, pdfOutputPath );
 
        wkb.Close();
        app.Quit();
    }
    catch ( Exception ex )
    {
        Console.WriteLine( ex.StackTrace );
        throw ex;
    }
}

 

Code using Telerik PdfFormatProvider:

public override void Generate( DimensionTableInput input )
{
    CreateWorkbook();
    CreateWorkbookStyles();
    CreateWorksheets( input );
 
    XlsxFormatProvider xlsxFormatProvider = new XlsxFormatProvider();
 
    PdfFormatProvider pdfFormatProvider = new PdfFormatProvider();
    // this will result in 1 page per sheet
    pdfFormatProvider.ExportSettings = new Telerik.Windows.Documents.Spreadsheet.FormatProviders.Pdf.Export.PdfExportSettings( ExportWhat.EntireWorkbook, true );
 
    string xlsxFileName = $"{input.DocumentTitle}.xlsx";
    string xlsxFullPath = $"{ Path.Combine( input.OutputPath, xlsxFileName )}";
    ExportToFile( xlsxFormatProvider, xlsxFullPath );
 
    string pdfFileName = $"{input.DocumentTitle}.pdf";
    string pdfFullPath = $"{ Path.Combine( input.OutputPath, pdfFileName )}";
    ExportToFile( pdfFormatProvider, pdfFullPath );
    //Helpers.ExcelHelper.ExcelToPdf( xlsxFullPath, pdfFullPath );
}
 
private void ExportToFile( IWorkbookFormatProvider formatProvider, string fileName )
{
    using ( Stream fs = File.OpenWrite( fileName ) )
    {
        formatProvider.Export( _workbook, fs );
    }
}

 

I can share the original Excel and Pdf files if needed.

Thanks in advance,

John

Chris
Top achievements
Rank 1
 answered on 11 Jun 2020
3 answers
125 views

I need to read the data from an excel file (not formatted) and in order to do this I need to find a cell that contains a specific text.

I am trying to do this

FindOptions options = new FindOptions()
{
    FindWhat = "Record",
    MatchEntireCellContents = true
};

but it fails with:

System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.Windows.Documents.Spreadsheet.Utilities.FindAndReplaceHelper.MoreThan(WorksheetCellIndex left, WorksheetCellIndex right, FindBy searchBy)
   at Telerik.Windows.Documents.Spreadsheet.Utilities.FindAndReplaceHelper.<>c__DisplayClass3_0.<OrderResults>b__0(FindResult result)
   at System.Linq.Enumerable.TakeWhileIterator[TSource](IEnumerable`1 source, Func`2 predicate)+MoveNext()
   at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)
   at Telerik.Windows.Documents.Spreadsheet.Utilities.FindAndReplaceHelper.OrderResults(FindOptions findOptions, IEnumerable`1 findResults)
   at Telerik.Windows.Documents.Spreadsheet.Model.Workbook.Find(FindOptions findOptions)

While looking in the code I have discovered that is because the StartCell is null. Where does it say that the StartCell is mandatory? Also why is the StartCell mandatory?

Dimitar
Telerik team
 answered on 27 May 2020
2 answers
1.2K+ views

Hi,

 

Is there a way to check if a pdf file is corrupted using pdfprocessing?

 

i'm working on a upload pdf file tool and it will be nice to check if the pdf is or not corrupted before upload. I've already check if the file header is pdf but some corrupted files gone thought.

 

Thanks!!

ANTONIO
Top achievements
Rank 1
 answered on 26 May 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?