Draggable Width and Height - Aspose.Cells.GridWeb

Hello support,
is it possible to have Draggable width and Height for

Aspose.Cells.GridWeb from client side?.

Or autoheight and width based on the browser width and height.

Please advise.

Hi,


Thanks for your query.

Yes, it is possible with the help of jquery. I have attached a sample project (using latest Aspose.Cells.GridWeb v8.8.0) to demonstrate it, please find it attached.

Thank you.

Hi Amjad Sahi,

Thanks for the sample project. It works fine if we manually scroll.
1. It is possible to view appropriate while loading itself?
2. It is possible to show the Top of the Excel instead of the bottom?

or if we have Auto height and Auto Width also fine for me.

Thanks

Hi,


Thanks for the screenshots with details.

Well, you need to set the width/height of the GridWeb as per your browser window to minimize the empty space while loading. I think you may set the Width and height of the GridWeb accordingly, see the sample updated lines of code (in the .aspx file) for your reference:
e.g
Sample code:

<acw:GridWeb ID=“gridwebtest1” runat=“server” EnableAJAX=“True” width=“1250” OnSubmitCommand=“GridWeb1_SubmitCommand”/>

2) Well, you may set the active cell accordingly for your needs, see the sample updated lines of code from .cs file in the project:
e.g
Sample code:

protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack == false)
{
string path = Server.MapPath("\source.xlsx");
gridwebtest1.ImportExcelFile(path);
gridwebtest1.WorkSheets[0].ActiveCell = “A1”;
}
}


Hope, this helps a bit.

Thank you.

Hi Amjad Sahi,

Thanks for your code. It works Perfect.
Can we set Auto Height / determine the height of the Excel from Javascript or C#?

Please advise.
Thanks

Hi,


Well, you may try to use Javascript code to accomplish the task. For example, first you need to get width and height of the current window of the browser type. Then you will resize GridWeb control with respect to the specified height and width accordingly. See the sample code (of the .aspx web form) for your reference:
e.g
Sample code:


<%@ Page Language=“C#” AutoEventWireup=“true” CodeFile=“TestGridWeb.aspx.cs” Inherits=“TestGridWeb” %>


<%@ Register TagPrefix=“acw” Namespace=“Aspose.Cells.GridWeb” Assembly=“Aspose.Cells.GridWeb” %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
//www.w3.org/1999/xhtml">


Untitled Page
//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">





<div id="resizable" class="ui-widget-content">







Hope, this helps a bit.

Thank you.

Hi Amjad Sahi,
No, I am not asking for the actual window height and width. I need to SET actual HEIGHT for the excel sheet. I dont need Width.

We need to set Height automatically based on the EXCEL content height.

Thanks for your help.

Hi,


I am not sure if this is possible. Same thing you may think, e.g., How could you ask MS Excel to determine the Excel file (which is going to be loaded into it), so it could adjust its height and width based on the spreadsheet contents (data/objects, etc.) automatically? Well, you have to set and specified the size of Excel application by yourself manually. Although, you may determine (but after importing the file into GridWeb) maximum (farthest) row and column indices by using MaxDataRow/MaxRow, MaxDataColumn/MaxColumn attributes of GridCells class in Aspose.Cells.GridWeb APIs, so you could adjust the size of the GridWeb a bit accordingly.

Thank you.