Adding Ribbon to spreadsheet causes it to run out of memory

0 Answers 66 Views
Spreadsheet
Lloyd Johnson
Top achievements
Rank 1
Lloyd Johnson asked on 13 Feb 2023, 06:58 PM

I'm attempting to add a spreadsheet to my app and so am simply running code from the demos to get it to display. If I run the code as shown below, it runs out of memory. If I comment out the RadSpreadsheetRibbon line, the spreadsheet displays just fine.

In my code-behind, I have the following line is limiting the spreadsheet to 50 x 100.

    <Grid x:Name="spreadsheetLayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <telerik:RadSpreadsheetRibbon x:Name="ribbon" BackstageClippingElement="{Binding ElementName=spreadsheetLayoutRoot, Mode=OneTime}" RadSpreadsheet="{Binding ElementName=radSpreadsheet, Mode=OneTime}"/>
        <Controls:RadSpreadsheetFormulaBar Grid.Row="1" RadSpreadsheet="{Binding ElementName=radSpreadsheet, Mode=OneTime}"/> 
        <telerik:RadSpreadsheet x:Name="radSpreadsheet" DataContext="{Binding CommandDescriptors, ElementName=radSpreadsheet}" Grid.Row="2">
            <telerik:RadSpreadsheet.FormatProviders>
                <Xls:XlsFormatProvider/>
                <Xlsx:XlsxFormatProvider/>
            </telerik:RadSpreadsheet.FormatProviders>
        </telerik:RadSpreadsheet>
        <Controls:RadSpreadsheetStatusBar Grid.Row="3" RadSpreadsheet="{Binding ElementName=radSpreadsheet, Mode=OneTime}"/>
    </Grid>
</UserControl>

Any suggestions?

Anna
Telerik team
commented on 14 Feb 2023, 09:26 AM

Hi,

Unfortunately, I have not been able to reproduce the issue so far. Would it be convenient for you to prepare a sample app and send it with a support ticket to us?

I am looking forward to your reply,

Anna

Lloyd Johnson
Top achievements
Rank 1
commented on 15 Feb 2023, 03:22 AM

I'm working with your sample files:

<UserControl x:Class="bbp.UserControls.Cutlist"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:bbp.UserControls"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
             xmlns:Controls="clr-namespace:Telerik.Windows.Controls.Spreadsheet.Controls;assembly=Telerik.Windows.Controls.Spreadsheet" 
             xmlns:Txt="clr-namespace:Telerik.Windows.Documents.Spreadsheet.FormatProviders.TextBased.Txt;assembly=Telerik.Windows.Documents.Spreadsheet" 
             xmlns:Csv="clr-namespace:Telerik.Windows.Documents.Spreadsheet.FormatProviders.TextBased.Csv;assembly=Telerik.Windows.Documents.Spreadsheet" 
             xmlns:Pdf="clr-namespace:Telerik.Windows.Documents.Spreadsheet.FormatProviders.Pdf;assembly=Telerik.Windows.Documents.Spreadsheet.FormatProviders.Pdf" 
             xmlns:Xlsx="clr-namespace:Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsx;assembly=Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml" 
             mc:Ignorable="d" 
             d:DesignHeight="642.088" d:DesignWidth="1106.426">
    <Grid>

        <Grid x:Name="spreadsheetLayoutRoot">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <telerik:RadSpreadsheetRibbon BackstageClippingElement="{Binding ElementName=spreadsheetLayoutRoot, Mode=OneTime}" RadSpreadsheet="{Binding ElementName=radSpreadsheet, Mode=OneTime}"/>
            <Controls:RadSpreadsheetFormulaBar RadSpreadsheet="{Binding ElementName=radSpreadsheet, Mode=OneTime}" Grid.Row="1"/>
            <telerik:RadSpreadsheet x:Name="radSpreadsheet" Grid.Row="2">
                <telerik:RadSpreadsheet.FormatProviders>
                    <Txt:TxtFormatProvider/>
                    <Csv:CsvFormatProvider/>
                    <Pdf:PdfFormatProvider/>
                    <Xlsx:XlsxFormatProvider/>
                </telerik:RadSpreadsheet.FormatProviders>
            </telerik:RadSpreadsheet>
            <Controls:RadSpreadsheetStatusBar RadSpreadsheet="{Binding ElementName=radSpreadsheet, Mode=OneTime}" Grid.Row="3"/>
        </Grid>

    </Grid>
</UserControl>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace bbp.UserControls
{
    /// <summary>
    /// Interaction logic for Spreadsheet.xaml
    /// </summary>
    public partial class Cutlist : UserControl
    {
        public Cutlist()
        {
            InitializeComponent();
        }
    }
}

 

After the out of memory error, the debugger stops in RadWorksheetLayout.cs at line 93:

this.visibleSize - visibleSize;

Finally, if I comment out the RadSpreadsheetRibbon line, the spreadsheet appears. I no longer have the visibleSize = new SizeI (50,100) line in my code but was getting the same out of memory error anyway.

I am running this from inside my desktop app from a RadTabGroup using the following:

                            Cutlist viewCutlist = new Cutlist();
                            AddControlToTab(viewCutlist, (RadTabItem)RadTabControlMain.Items[3]);

Lloyd Johnson
Top achievements
Rank 1
commented on 16 Feb 2023, 03:09 AM

Instead of invoking from a RadTabGroup, I switched to a Rad Menu Item and the spreadsheet opened with the Ribbon. using this code:

                        CommonForm commonForm = new CommonForm();
                        Cutlist cutlist = new Cutlist();
                        commonForm.AddUserControl(cutlist);
                        commonForm.ShowDialog();

I don't know why this would make a difference, but the user conrol opens with the ribbon in one and not the other. :-<

It doesn't open very quick but it does open so I can live with that. I'll tray adding a visibleSize command and see if that helps.

Anna
Telerik team
commented on 16 Feb 2023, 06:37 AM

Hi,

This is indeed very peculiar. Onca again, I tried to run RadSpreadsheet in a RadTabItem, but everything seems to go smoothly. There must be something that I am missing and, if this is still a problem for you, it would be a great help if you could isolate the behavior in a sample project and send it over for us to investigate.

Regards,

Anna

No answers yet. Maybe you can help?

Tags
Spreadsheet
Asked by
Lloyd Johnson
Top achievements
Rank 1
Share this question
or