Telerik Forums
Telerik Document Processing Forum
3 answers
232 views
Hi!

I created a worksheet via SpreadProcessing, export it to PDF and all works well. Now I would like to have a footer (eg. like in Excel, footer-left, footer-center, footer-right) and maybe also a header which gets repeated on each page, in addition I need the column headers to be repeated on each page. How can I achieve that?

Regards
Neils
Boyko
Telerik team
 answered on 20 Jul 2016
4 answers
1.3K+ views

Hi,

as a proof of concept, I want to load a Docx in a Kendo Editor and save it back. So far, I'm able to

  1. load a Docx, convert it to HTML
  2. then using Telerik ASP.Net MVC Editor I'm able to modify the HTML
  3. Save it back to a new Docx document

The issues I have is that the new docx don't have the same margins as the original document and it also takes 4 pages instead of 2. You can take a look at the screenshots attached (before/after).

 

Is there a way to configure the styles and the page setup ?

 

here is the code that I use. Basically, I have a Kendo Editor in my view that loads the HTML and a button to save back the data

 

[HttpPost]
public ActionResult Editor(string editor)
{
    // HTML decode the value before using it.
    var notes = System.Web.HttpUtility.HtmlDecode(editor);
      
    var htmlProvider = new HtmlFormatProvider();
    RadFlowDocument document = htmlProvider.Import(notes);
 
    SaveDocx(document);
     
    return View();
}
 
public ActionResult Editor()
{
    RadFlowDocument sourceDoc = GetSourceDocument();
    SaveDocx(sourceDoc);
    var myHtmlContent = GetHtmlFromDocument(sourceDoc);
 
    ViewBag.MyHtmlContent = myHtmlContent;
 
    return View();
}
 
private RadFlowDocument GetSourceDocument()
{
    var docxProvider = new DocxFormatProvider();
    var stream = new MemoryStream(System.IO.File.ReadAllBytes(@"c:\Temp\TelerikMvcApp1\TelerikMvcApp1\Fiche.docx"));
    RadFlowDocument document;
 
    using (Stream input = System.IO.File.OpenRead(@"c:\Temp\TelerikMvcApp1\TelerikMvcApp1\Fiche.docx"))
    {
        document = docxProvider.Import(stream);
    }
 
    return document;
}
 
private string GetHtmlFromDocument(RadFlowDocument document)
{
    var myHtmlContent = "";
    using (MemoryStream ms = new MemoryStream())
    {
        HtmlFormatProvider htmlProvider = new HtmlFormatProvider();
        myHtmlContent = htmlProvider.Export(document);
    }
 
    return myHtmlContent;
}
 
private void SaveDocx(RadFlowDocument document)
{
    using (Stream output = System.IO.File.OpenWrite(String.Format(@"c:\Temp\TelerikMvcApp1\TelerikMvcApp1\Fiche{0}.docx", DateTime.Now.Ticks)))
    {
        DocxFormatProvider docxProvider = new DocxFormatProvider();
        docxProvider.Export(document, output);
    }
}

 

thanks

Pierre Yves
Top achievements
Rank 1
 answered on 19 Jul 2016
1 answer
379 views

Hi,

I am creating an pdf document from an html, which contains a number of images. I notice a difference between the pdf created and when viewing the html in a browser. For example the html contains css to resize the images, however it appears this does not happen during the pdf conversion process, so the images look too big.

Thanks

I use the code below to create the pdf

try {     using (var inputHtml = new MemoryStream(htmlEncoding.GetBytes(sourceString)))     {         var htmlProvider = new HtmlFormatProvider();         var document = htmlProvider.Import(inputHtml);         var editor = new RadFlowDocumentEditor(document);         using (Stream output = new FileStream(targetFolder + targetFilename, FileMode.OpenOrCreate))         {             var pdfProvider = new PdfFormatProvider();             pdfProvider.Export(document, output);         }     } }

Tanya
Telerik team
 answered on 07 Jul 2016
1 answer
263 views
I am currently converting a byte array of a spreadsheet which is stored in a database into a workbook from the XlsxFormatProvider, after doing this I am then converting this workbook into a PDF for export which all works fine. My issue is that during the conversion the formulas used to calculate values is being shown rather then the actual result.
Petya
Telerik team
 answered on 16 Jun 2016
5 answers
547 views

Hi,

please help me.

This is my problem:

I compress some files with this code

Try
            Using st As Stream = File.OpenWrite(FileZippato)
                Using zipArchive As ZipArchive = New ZipArchive(st, ZipArchiveMode.Create, False, Nothing)
                    For Each f As String In FileOrigine
                        Extensions.ZipFile.CreateEntryFromFile(zipArchive, f, Path.GetFileName(f))
                    Next
                End Using
            End Using

        Catch ex As Exception
            Globale.Log.BoxErrore(ex)
        End Try

so everything is right

when I unzip the file with

            Extensions.ZipFile.ExtractToDirectory(FileOrigine, CartellaDestinazione)

catch this exception "folder access denied".

of course access to this folder is totally free
Nikolay Demirev
Telerik team
 answered on 16 Jun 2016
1 answer
264 views

Hello,

I am currently moving from exporting a RadGridView from ExcelML to SpreadProcessing.  Everything exports fine and I am able to set most of the options I need that relate to printing except one option.

In excel, there is an option for "Scale To Fit".  I'd like this to be set to 1 page automatically on export so all columns fit on one page regardless of how many there are.  I know there is a ScaleFactor on the WorksheetPageSetup but would like it to be more dynamic.

Thanks,

Chris

Tanya
Telerik team
 answered on 14 Jun 2016
1 answer
465 views
Excel has the scaling option "Fit All Columns on One Page". Is there an equivalent setting in the Telerik printing options? I haven't been able to find any examples in the documentation or forums. Thanks for any help you can offer.
Tanya
Telerik team
 answered on 06 Jun 2016
6 answers
224 views

Hi,

I have stripped our use down to be a very simple data-dump.

Row 1 = column headers
Rows 2 to N = data

I am using the auto filtering feature  

sheet.Filter.FilterRange = sheet.UsedCellRange;

once all the data has been written

File is being saved

IWorkbookFormatProvider XSLXwriter = new XlsxFormatProvider();

using (FileStream filestream = new FileStream(filename, FileMode.Create))
    XSLXwriter.Export(output, filestream);

Output is a Workbook and filename is a unique string.

I am simulating a user experience of wanting to us the sorting options provided within Excel however this causes a crash and the file to be recovered. Saving and re-opening fixes this problem. Comparing workbook.xml from the before(which crashes) and after(save as copy) it looks like this is missing.

<definedNames>
    <definedName name="_xlnm._FilterDatabase" localSheetId="0" hidden="1">Sheet1!$A$1:$GJ$531</definedName>
  </definedNames>
  <calcPr calcId="0"/>

If you could advise on solving this issue it would be great.

Many Thanks

Nikolay Demirev
Telerik team
 answered on 31 May 2016
1 answer
241 views

Is it possible to format some parts of the text inside a cell? Something like the formatting shown in the attached image.

Tanya
Telerik team
 answered on 13 May 2016
1 answer
447 views

I'm new to creating with PDFs and this control.  I'm trying to create a PDF that could be used to print an employee ID badge.  It looks like the whole card will need to be about 250 x 360 pixels, based on a template someone sent me that can be used to print now.

How does image quality work with this control?  Can images be added with a higher resolution than the pixels used when placing it in the PDF?

Deyan
Telerik team
 answered on 13 May 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?