Hi all,
I am trialing Aspose.Slides with a full trial licence.
Using the Aspose sample code I just wish to change the row height of tables from 30 to 20 but for some reason this was not possible. I would expect to change the original line in red from
double[] dblRows = { 50, 30, 30, 30, 30 }; to double[] dblRows = { 50, 20, 20, 20, 20 };
However, this simple setting was not possible and the row height did not appear to change. I must be doing something silly? Please advise guys, thanks.
The default Aspos sample is as below:
using System.IO;
using Aspose.Slides;
using System.Drawing;
namespace CSharp.Tables
{
public class TableFromScratch
{
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Tables();
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
//Instantiate Presentation class that represents PPTX file
using (Presentation pres = new Presentation())
{
//Access first slide
ISlide sld = pres.Slides[0];
//Define columns with widths and rows with heights
double[] dblCols = { 50, 50, 50 };
double[] dblRows = { 50, 30, 30, 30, 30 };
//Add table shape to slide
ITable tbl = sld.Shapes.AddTable(100, 50, dblCols, dblRows);
//Set border format for each cell
foreach (IRow row in tbl.Rows)
foreach (ICell cell in row)
{
cell.BorderTop.FillFormat.FillType = FillType.Gradient;
cell.BorderTop.FillFormat.SolidFillColor.Color = Color.Red;
cell.BorderTop.Width = 2;
cell.BorderBottom.FillFormat.FillType = FillType.Solid;
cell.BorderBottom.FillFormat.SolidFillColor.Color = Color.Red;
cell.BorderBottom.Width = 2;
cell.BorderLeft.FillFormat.FillType = FillType.Pattern;
cell.BorderLeft.FillFormat.SolidFillColor.Color = Color.Red;
cell.BorderLeft.Width = 2;
cell.BorderRight.FillFormat.FillType = FillType.Solid;
cell.BorderRight.FillFormat.SolidFillColor.Color = Color.Red;
cell.BorderRight.Width = 2;
}
//Merge cells 1 & 2 of row 1
tbl.MergeCells(tbl[0, 0], tbl[1, 0], false);
//Add text to the merged cell
tbl[0, 0].TextFrame.Text = “Merged Cells”;
//Write PPTX to Disk
pres.Save(dataDir + “table.pptx”, Aspose.Slides.Export.SaveFormat.Pptx);
}
}
}
}
Regards,
Anil
Hi Anil,
row.MinimalHeight = row.MinimalHeight +30;
Hi Mudassir,
Hi Anil,