Telerik Forums
Telerik Document Processing Forum
2 answers
172 views

Hi,

I am evaluating the use of SpreadProcessing for downloading an excel file created from a "template excel file" where cells are filled with values.

In order to change the template we are using named ranges to know where to place the values. On forum I have found a thread where this functionality was requested and someone provide a solution using ConvertCellNameToIndex.

However when I tried it I got an exception:

Telerik.Windows.Documents.Spreadsheet.Utilities.LocalizableException occurred
  HResult=-2146233088
  LocalizationKey=Spreadsheet_ErrorExpressions_InvalidRowName
  Message='4 evaluare'!$B$1' is invalid row name.
  Source=Telerik.Windows.Documents.Spreadsheet
  StackTrace:
       at Telerik.Windows.Documents.Spreadsheet.Utilities.NameConverter.ConvertRowNameToIndex(String rowName)
  InnerException: 
       HResult=-2146233079
       Message='4 evaluare'!$B$1' is invalid row name.
       InnerException: 

This is the cellName used => "='Anexa4 evaluare'!$B$1"

Is this an issue? What are my options in order to not get this error?

Tanya
Telerik team
 answered on 10 Jan 2018
7 answers
725 views

Hi,

 

I have an issue with converting between HTML and DOCX and vice versa. What happens is that I export an HTML unordered list to docx and then back from docx to HTML, using DocxFormatProvider and HtmlFormatProvider. The condensed code below illustrates my problem.

Version of Telerik.Windows.Document.* libraries is 2017.2.428.40, version of DocumentFormat.OpenXml is 2.5.5631.0.

 

var html = "<ul><li>1</li><li>2</li></ul>";
Console.WriteLine("Original HTML: "+html);
var docxFormatProvider = new DocxFormatProvider();
var htmlFormatProvider = new HtmlFormatProvider();
var document = htmlFormatProvider.Import(html);
var bytes = docxFormatProvider.Export(document);
document = docxFormatProvider.Import(bytes);
htmlFormatProvider.ExportSettings.DocumentExportLevel = DocumentExportLevel.Fragment;
htmlFormatProvider.ExportSettings.StylesExportMode = StylesExportMode.None;
htmlFormatProvider.ExportSettings.IndentDocument = false;
html = htmlFormatProvider.Export(document);
Console.WriteLine("New HTML: "+html);
Console.ReadKey();

 

The console output is:

Original HTML: <ul><li>1</li><li>2</li></ul>
New HTML: <body><ul style="list-style-type: disc;"><li style="font-family: Symbol;" value="1"><span style="font-family: Times New Roman;">1</span></li><li style="font-family: Symbol;" value="2"><span style="font-family: Times New Roman;">2</span></li></ul></body>

 

The ooxml generated when exporting the HTML to docx is:

  <w:body>
    <w:p>
      <w:pPr>
        <w:pStyle w:val="NormalWeb" />
        <w:numPr>
          <w:ilvl w:val="0" />
          <w:numId w:val="1" />
        </w:numPr>
        <w:rPr />
      </w:pPr>
      <w:r>
        <w:rPr />
        <w:t>1</w:t>
      </w:r>
    </w:p>
    <w:p>
      <w:pPr>
        <w:pStyle w:val="NormalWeb" />
        <w:numPr>
          <w:ilvl w:val="0" />
          <w:numId w:val="1" />
        </w:numPr>
        <w:rPr />
      </w:pPr>
      <w:r>
        <w:rPr />
        <w:t>2</w:t>
      </w:r>
    </w:p>
    <w:sectPr />
  </w:body>
</w:document>

 

What puzzles me is the style definitions on the exported html, for instance font-family: Symbol; on the list elements. We're using the JavaScript API for Office to inject the exported HTML into content controls in Word documents. The example HTML here injects a bullet list in the content control, but if the user adds new bullets to the list in word the font is set to Symbol. Also, I don't understand why spans with font-family Times New Roman is added, this is causing some line spacing issues and we are using Arial as standard.

 

Does anyone have some input on this? Thanks.

 

Best regards,

Geir Morten Hagen

Tanya
Telerik team
 answered on 10 Jan 2018
8 answers
967 views

Hello,
I'm having trouble breaking a new page using HtmlFormatProvider and PdfFormatProvider

My code

var html = "<h1>firstpage</h1><?hard-pagebreak?><h1>secondpage</h1>";
HtmlFormatProvider prov = new HtmlFormatProvider();
RadFlowDocument document = prov.Import(html);
 
var provider = new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();
var ouput = provider.Export(document);
File.WriteAllBytes(@"D:\a.pdf", ouput);

 

What am I doing wrong ?

 

 

Tanya
Telerik team
 answered on 29 Dec 2017
1 answer
136 views

Is there a way to use a Worksheet "Or Convert it to" a dataSource that would be compatible with RadGridView?

I'm currently working on building a list from the activeWorksheet but it cause multiple issues "Header name, Columns Type, ect..

 

Thank you!

Peshito
Telerik team
 answered on 25 Dec 2017
10 answers
223 views

Hello, Telerik,

 

Is Conditional Formatting supported in RadSpreadProcessing? If not, will it be ever available?

Tanya
Telerik team
 answered on 27 Nov 2017
4 answers
297 views

 

Hi,

We are using PdfProcessing to read PDF file.

The code used:

Dim document As RadFixedDocument = provider.Import(stream)

However, some of the text are converted to weird characters.

Here is the document used: http://upload.ximnet.com.my/huisheng/sample_pdf.pdf

The text are converted from "DATO’ SERI AHMAD HUSNI MOHAMAD HANADZLAH" to "'A72’ 6(5, A+0A' +861, 02+A0A' +A1A'ZLAH"

Is there any setting that we need to set in the code?

Thanks.

 

XiMnet Malaysia
Top achievements
Rank 1
 answered on 07 Nov 2017
0 answers
138 views

compressing and decompressing functions -

 

private string CompressString(string str, string strInflateDeflate)
        {
            string strReturnValue = "";

            if (str != "")
            {
                MemoryStream memoryStream = new MemoryStream();
                CompressionMethod method = (CompressionMethod)Enum.Parse(typeof(CompressionMethod), strInflateDeflate, false);
                CompressionSettings settings;
                switch (strInflateDeflate)
                {
                    case "Deflate":
                        {
                            settings = new DeflateSettings();
                        }
                        break;
                    case "Lzma":
                        {
                            settings = new LzmaSettings();
                        }
                        break;
                    default:
                        {
                            settings = new StoreSettings();
                        }
                        break;
                }

                using (CompressedStream compressedStream = new CompressedStream(memoryStream, StreamOperationMode.Write, settings))
                {
                    //byte[] decBytes = Encoding.UTF8.GetBytes(str);
                    byte[] decBytes = Encoding.UTF8.GetBytes(str);
                    compressedStream.Write(decBytes, 0, decBytes.Length);
                }

                strReturnValue = Convert.ToBase64String(memoryStream.ToArray());
            }

            return strReturnValue;
        }

        private string DecompressString(string str, string strInflateDeflate)
        {
            string strReturnValue = "";

            if (str != "")
            {
                MemoryStream memoryStream = new MemoryStream();
                MemoryStream outputStream = new MemoryStream();
                CompressionMethod method = (CompressionMethod)Enum.Parse(typeof(CompressionMethod), strInflateDeflate, false);
                CompressionSettings settings;
                switch (strInflateDeflate)
                {
                    case "Deflate":
                        {
                            settings = new DeflateSettings();
                        }
                        break;
                    case "Lzma":
                        {
                            settings = new LzmaSettings();
                        }
                        break;
                    default:
                        {
                            settings = new StoreSettings();
                        }
                        break;
                }

                byte[] byteArray = Encoding.ASCII.GetBytes(contents);

                memoryStream = new MemoryStream();
                memoryStream.Write(byteArray, 0, byteArray.Length);

                using (CompressedStream compressedStream = new CompressedStream(memoryStream, StreamOperationMode.Read, new DeflateSettings()))
                {
                    compressedStream.CopyTo(outputStream);
                }

                strReturnValue = Convert.ToBase64String(outputStream.ToArray());
            }

            return strReturnValue;
        }

 

 

The above functions are not giving proper output.

Can anybody suggest what corrections are required ?

 

Thanks

 

Milind Shevade

Milind
Top achievements
Rank 1
 asked on 29 Oct 2017
4 answers
283 views

The IfError and Match functions are not implemented. Any chance of getting these implemented?

 

Also Vlookup, but this has already been mentioned on another thread

Anna
Telerik team
 answered on 26 Oct 2017
1 answer
516 views
I add a table to my document. I can add text to a table cell and style it (bold, italic, etc), but I don't know how to add a hyperlink to a table cell. All I see is "editor.InsertHyperlink()", but it adds the hyperlink below my table, not in my table cell.
Polya
Telerik team
 answered on 23 Oct 2017
6 answers
453 views

Hello,

This is a pre-sale question. We're asked to allow corporate users to view online existing Excel files that contain multiple sheets.

We know viewing is possible when the Excel file contains only one sheet.

Does anyone know whether this is possible to do when the imported Excel file contains more than one sheet (in our case more than 10)?

 

Thanks much in advance.

Chanan Zass
Top achievements
Rank 1
 answered on 17 Oct 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?