Telerik Forums
Telerik Document Processing Forum
1 answer
379 views

Hi,

 I have Performance Issues with the Excel spreadprocessing export. To populate a 1000x1000 matrix takes 70 seconds.

Can you please have a look? Thank you!

 

namespace WpfApplication1
{
    public partial class MainWindow : Window
    {
        private readonly int SIZE = 1000;

        public MainWindow()
        {
            
            InitializeComponent();

            WorkbookFormatProvidersManager.RegisterFormatProvider(new XlsxFormatProvider());
            test();

        }

        public object[,] populateData()
        {
           
            var res = new object[SIZE,SIZE];


            for(int row=0;row<SIZE;row++)
                for(int col=0;col<SIZE;col++)
                    res[row,col] = row+col;

            return res;

        }

        public void test()
        {
            Stopwatch s = Stopwatch.StartNew();
            var sensorDataTable = populateData();
           
            s.Stop();
            Console.WriteLine(string.Format("populate {0} items: {1}ms", SIZE*SIZE, s.ElapsedMilliseconds));

            s = Stopwatch.StartNew();
            Telerik.Windows.Documents.Spreadsheet.Model.Workbook workbook = new Telerik.Windows.Documents.Spreadsheet.Model.Workbook();
            using (new UpdateScope(workbook.SuspendLayoutUpdate, workbook.ResumeLayoutUpdate))
            {
                using (new UpdateScope(
                    () => { workbook.History.IsEnabled = false; },
                    () => { workbook.History.IsEnabled = true; }))
                {
                    workbook.Sheets.Add(SheetType.Worksheet);
                    Telerik.Windows.Documents.Spreadsheet.Model.Worksheet worksheet = workbook.ActiveWorksheet;

                    for(int row=0;row<SIZE;row++)
                        for(int col=0;col<SIZE;col++)
                            worksheet.Cells[row, col].SetValue(sensorDataTable[row, col].ToString());

                    worksheet.Columns[worksheet.UsedCellRange].AutoFitWidth();
                }
            }

            String filename = @"c:\test.xlsx";

            IWorkbookFormatProvider formatProvider = WorkbookFormatProvidersManager.GetProviderByName("XlsxFormatProvider");
            using (var stream = new FileStream(filename, FileMode.CreateNew, FileAccess.ReadWrite))
            {
                formatProvider.Export(workbook, stream);
            }
            s.Stop();
            Console.WriteLine(string.Format("create and save excel: {0}ms", s.ElapsedMilliseconds));
        }

    }
}


Nikolay Demirev
Telerik team
 answered on 06 Apr 2015
4 answers
544 views
 I have been using radspreadsheet for reading .csv files for some time now.  I am now working on an application that requires me to read .xslx files.  The only issue I have is the following: When reading percentage values, if the values are too small, I get a zero returned for the cell value.  For example, if my spreadsheet is:

0.10% 
1.00%
10.00%
100.00%

when reading the values, where the cell format is "percentage", I get the following values:
0
0.01
0.1
1

On the spreadsheet, I have the number of decimal points set to 6.

        private string GetCellValue(Worksheet ws, int RowIndex, int ColumnIndex)
        {
            CellSelection cell;
            ICellValue value;
            string cellvalue = "0";
            cell = ws.Cells[RowIndex, ColumnIndex];
            value = cell.GetValue().Value;
            if (value != null) cellvalue = value.RawValue.ToString();












Innermedia
Top achievements
Rank 2
 answered on 06 Apr 2015
1 answer
754 views
I try to convert an xlsx file to pdf. To do that I use WorkbookFormatProvidersManager.Import and export.
Thus, I declare 
using Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml;
using Telerik.Windows.Zip;
But I obtain a reject at compile time on the instruction 
 WorkbookFormatProvidersManager.RegisterFormatProvider(new XlsxFormatProvider());

XlsxFormatProvider is not found.
Where am'i wrong ?
Thanks for a reply.
Todor
Telerik team
 answered on 03 Apr 2015
3 answers
237 views
Since ZipPackage is now deprecated, is there a replacement to the IsZipFile method?  I haven't come across anything in the documentation yet...
Pavlina
Telerik team
 answered on 31 Mar 2015
1 answer
288 views
Hi,

Is there the equivalent of wpf RadSpreadSheet in winform ?

I mean the usercontrol allowing to display data in Excel style.


Regards,

Pixie.
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 30 Mar 2015
1 answer
172 views
Hi,

How do you decompress a stream now that this class is obsolete?  I used to have:

        public static byte[] Decompress(byte[] settings)
        {
            using (var zippedStream = new ZipInputStream(new MemoryStream(settings)))
            {
                return ReadFully(zippedStream);
            }
        }

        public static byte[] ReadFully(System.IO.Stream input)
        {
            var buffer = new byte[16 * 1024];
            using (var ms = new MemoryStream())
            {
                int read;
                while ((read = input.Read(buffer, 0, buffer.Length)) > 0)
                {
                    ms.Write(buffer, 0, read);
                }
                return ms.ToArray();
            }
        }

Is it still ok to use CompressedStream directly and if so how do you create the CompressionSettings as the Method setter is protected?

Thanks,

Scott
Scott Waye
Top achievements
Rank 2
Iron
Iron
Veteran
 answered on 27 Mar 2015
1 answer
412 views
Hi,

I found no direct option for Landscape formats.
So what I do ATM is to set the size with
Size sZ = PaperTypeConverter.ToSize(PaperTypes.A4);
swap width / height a this size and assign it to the page.size

Did I miss something (some "hidden" property) - or is this the way to do it?

Manfred
Tanya
Telerik team
 answered on 25 Mar 2015
2 answers
235 views
Hi,

I have a view which looks something like this:
<Viewbox>
    <Canvas Width="800" Height="1050" x:Name="caContent">
        <Image x:Name="imgBackground" Source="Images/Proto1.png" Stretch="UniformToFill" Width="800" Height="1050"/>
    </Canvas>
</Viewbox>

At runtime I load a background image an after that I place controls (TextBlock) on the Canvas which are bound to data.
So after all I have some kind of a report "printed" on the screen.
I can also print this report (it's designed to fit on A4 paper format).

Now my question - is there an easy way to save this report as PDF?

I've seen your samples where FirstLook looked promising - but I had to learn that it displays an image "resultDocument...png" and not the data.
And the "rendering code" is working with a "FixedContentEditor" and special rendering.

My idea was that I can "print" to your PDF component like to a printer - or in other words - use the existing (for screen rendering) code and simply render the result to PDF.
Is this possible?

Thank you
Manfred
ManniAT
Top achievements
Rank 2
 answered on 24 Mar 2015
2 answers
304 views
Is there a way to output one specific worksheet to a PDF document?  Or, must I always rely on spreadsheet formatting?
Joel Palmer
Top achievements
Rank 2
 answered on 18 Mar 2015
3 answers
311 views
Hi,

we are currently using a free PDF Library to convert some XPS documents to PDF.
The XPS document has pages with different heights (so for an example page 1 is 6 cm high while page 2 has 11 cm).

Is this (render an XPS to PDF) also possible with telerik PDFProcessing?

The reason why I ask - we love your products (and quality, support,...) and the PDF library is the only "external component" (except telerik controls) we use in a pretty large project. It would be great to get rid of "the others" and instead use your PDFProcessing.

Thanks
Manfred
Tanya
Telerik team
 answered on 17 Mar 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?