Hi,
we are using Aspose.Cells for .NET (.net4.0 dll).
I’m using Apose inside powershell.
As an overview:
We are reading a text-file (plain texdt, separator is TAB.
After reading, I try to apply new a style for the header row.
The new Format is not applied.
(When saving the file as xlsx, all ma other data-m,anipulation are done.)
Here is what I’m doing:
#=====>> loadoptions for loading IPS-Text file
[Aspose.Cells.TxtLoadOptions]$TxtLoadOptions=New-Object Aspose.Cells.TxtLoadOptions;
$TxtLoadOptions.ConvertNumericData=$false;
$TxtLoadOptions.Separator=[char]9;
#<<===== loadoptions for loading IPS-Text file
$wb = new-object Aspose.Cells.Workbook($FilenameIn,$TxtLoadOptions);
[Int]$maxR;
[Int]$HFirstCol;
[Int]$HLastCol;
$maxR=$wb.Worksheets[0].Cells.MaxDataRow;
$HFirstCol=$wb.Worksheets[0].Cells.Rows[0].FirstCell.Column;
$HLastCol=$wb.Worksheets[0].Cells.Rows[0].LastCell.Column;
#=====>> Style & StyleFlags
#$Style = $wb.CreateStyle();
[Aspose.Cells.Style]$Style=$wb.CreateStyle();
$Style.Font.IsBold=$true;
$Style.Font.Name=“Calibri”;
$Style.Font.Size=14;
$styleFlag = New-Object Aspose.Cells.StyleFlag
$styleFlag.HorizontalAlignment = $true;
$styleFlag.VerticalAlignment = $true;
$styleFlag.ShrinkToFit = $true;
$styleFlag.Borders = $true;
$styleFlag.FontColor = $true;
$styleFlag.BottomBorder=$true;
#<<===== Style & StyleFlags
#=====>> creating 2. sheet as table
$wb.Worksheets.AddCopy(0);
#$wb.Worksheets.Add(“Pavis Table”);
[Aspose.Cells.Tables.ListObjectCollection] $listObjects = $wb.Worksheets[1].ListObjects;
$listObjects.Add(0, 0, $maxR, $HLastCol, $true);
[Aspose.Cells.Worksheet]$ws1=$wb.Worksheets[1];
$ws1.AutoFitRows(0, $maxR);
$ws1.AutoFitColumns(0,$HLastCol);
#<<===== creating 2. sheet as table