Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents from any .NET(C#, VB.NET, ASP.NET, .NET Core) application and Java (J2SE and J2EE) application.

Sun May 13, 2018 9:36 pm

I have used a widescreen pptx file (16:9) but after editing the resulting file is of type Standard (4:3). Please help..

manjudupi
 
Posts: 13
Joined: Wed Apr 18, 2018 5:55 pm

Mon May 14, 2018 1:54 am

Hello,

Thanks for your post.
I didn't notice the issue, could you please share your sample document and code for our better investigation?

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Mon May 14, 2018 9:19 am

Take any pptx file where Slide size is Widescreen (16:9). Load the presentation from MemortStream and save it. Now the Widescreen slides will be converted to Standard (4:3). In case If you are not able to reproduce the issue, I will post the code and also a sample pptx file. Please let me know.

manjudupi
 
Posts: 13
Joined: Wed Apr 18, 2018 5:55 pm

Mon May 14, 2018 9:19 am

FYI, I have table in the slide

manjudupi
 
Posts: 13
Joined: Wed Apr 18, 2018 5:55 pm

Mon May 14, 2018 9:51 am

Hello,

Thanks for your response.
Sorry I still couldn't reproduce the issue. Please provide the following details for our further investigation.
1. The input file as well as the code snippet.
2. The system configuration. Eg, Win 7, 64 bit.
3. The region and language information. Eg, China/Chinese.
Thanks in advance.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Mon May 14, 2018 2:36 pm

Sample Code:

public static MemoryStream ReplaceTableTags(PresentationInfo PresentationDocument, PresentationDocumentTables DocumentTables, FileFormat PresentationFormat)
{
Presentation PresentationFile = new Presentation(new MemoryStream(PresentationDocument.FileStream), PresentationFormat);
if (DocumentTables != null)
{
for (int i = 0; i < PresentationFile.Slides.Count; i++)
{
foreach (PresentationTable TableSubstitution in DocumentTables.Tables)
{
ITable Table = GetTableFromShapes(TableSubstitution.TableName, PresentationFile.Slides[i].Shapes);
if (Table != null)
{
foreach (TableCellContext CellContext in TableSubstitution.CellContext)
{
if (CellContext.RowIndex >= 0 && CellContext.ColumnIndex >= 0 && Table.TableRows.Count - 1 >= CellContext.RowIndex && Table.ColumnsList.Count - 1 >= CellContext.ColumnIndex)
{
List<TableCellContext> Duplicates = TableSubstitution.CellContext.Where(cell => cell.RowIndex == CellContext.RowIndex && cell.ColumnIndex == CellContext.ColumnIndex).ToList();
if (Duplicates.Count > 1)
{
double ColumnWidth = Table[CellContext.ColumnIndex, CellContext.RowIndex].Width / Duplicates.Count;
double[] ColumnWidths = new double[Duplicates.Count];
for (int z = 0; z < Duplicates.Count; z++)
ColumnWidths[z] = ColumnWidth;
double[] ColumnHeights = new double[] { (float)Table[CellContext.ColumnIndex, CellContext.RowIndex].Height };
ITable CellTable = PresentationFile.Slides[i].Shapes.AppendTable((float)Table[CellContext.ColumnIndex, CellContext.RowIndex].Width,
(float)Table[CellContext.ColumnIndex, CellContext.RowIndex].Height, ColumnWidths, ColumnHeights);
CellTable.SetTableBorder(TableBorderType.None, 0, Color.Transparent);
for (int a = 0; a < Duplicates.Count(); a++)
{
CellTable[a, 0].TextFrame.Text = Duplicates[a].Value;

//Can remove the below line if text alignment is specified in substitution data
CellTable[a, 0].TextFrame.IsCentered = Table[CellContext.ColumnIndex, CellContext.RowIndex].TextFrame.IsCentered;

CellTable[a, 0].FillFormat.SolidColor.Color = Color.Transparent;
ApplyCellStyle(Duplicates[a], CellTable[a, 0]);

//How to send this in substitution data?
/*CellTable[a, 0].BorderRight.Width = 1.0;
CellTable[a, 0].BorderRight.Style = TextLineStyle.Single;
CellTable[a, 0].BorderRight.FillType = FillFormatType.Solid;
CellTable[a, 0].BorderRight.DashStyle = LineDashStyleType.Solid;*/
}
CellTable.Left = Table.Left + (float)Table[CellContext.ColumnIndex, CellContext.RowIndex].OffsetX;
CellTable.Top = Table.Top + (float)Table[CellContext.ColumnIndex, CellContext.RowIndex].OffsetY;
TableSubstitution.CellContext.Where(Context => Context.RowIndex == CellContext.RowIndex && Context.ColumnIndex == CellContext.ColumnIndex).ToList().ForEach(Context => { Context.ColumnIndex = -1; Context.RowIndex = -1; });
continue;
}
Table[CellContext.ColumnIndex, CellContext.RowIndex].TextFrame.Text = CellContext.Value;
ApplyCellStyle(CellContext, Table[CellContext.ColumnIndex, CellContext.RowIndex]);
}
}
}
}
}
}
MemoryStream PresentationData = new MemoryStream();
//PresentationFile.SlideSize.Size = PresentationFile.SlideSize.SizeOfPx;
// PresentationFile.SlideSize.SizeOfPx = PresentationFile.SlideSize.SizeOfPx;
//PresentationFile.SlideSize.Type = PresentationFile.SlideSize.Type;
//PresentationFile.SetPageSize(16.0F, 9.0F, true);
PresentationFile.SaveToFile(PresentationData, PresentationFormat);
//PresentationFile.SlideSize.Type = SlideSizeType.
return PresentationData;
}
You do not have the required permissions to view the files attached to this post.

manjudupi
 
Posts: 13
Joined: Wed Apr 18, 2018 5:55 pm

Mon May 14, 2018 2:44 pm

Please have a look.. I recommended this tool to my client. Now we are in QA and I am not in the position to recommend some other tool now to handle presentations.

If possible please let me know how to split a table cell into two or have a table inside a table cell.

manjudupi
 
Posts: 13
Joined: Wed Apr 18, 2018 5:55 pm

Tue May 15, 2018 4:08 am

Hello,

Thanks for your code.
1. I could still get the correct result by using the below code. I also tried adding a table, it works ok.
Code: Select all
Presentation ppt = new Presentation();

byte[] byts = File.ReadAllBytes("Vision Comparison.pptx");
MemoryStream ms = new MemoryStream(byts);
ppt.LoadFromStream(ms, FileFormat.Pptx2010);
 
ppt.SaveToFile("13796.pptx", FileFormat.Pptx2010);

Please check twice using the simple code I provided with the latest version(Spire.Presentation Pack Hotfix Version:3.5.1).
In addition, you could use the code " ppt.SlideSize.Type = SlideSizeType.Screen16x9;" to set the slide size to be 16:9.

2.As for the second case, we have a method to split the cell, yet it is private now. We will consider making it public. Below is the sample code for adding a table in a table cell.
Code: Select all
//Create PPT document
Presentation presentation = new Presentation();

//Add a teble in the first slide
Double[] widths = new double[] { 200, 200 };
Double[] heights = new double[] { 100, 100 };
ITable table = presentation.Slides[0].Shapes.AppendTable(170, 80, widths, heights);

//Add another table at the position of the first table cell in the previous table
table[0, 0].Slide.Shapes.AppendTable(175, 100, new double[] { 80, 80 }, new double[] { 25, 25 });

//Save the document
presentation.SaveToFile("TabelInTable.pptx", FileFormat.Pptx2010);

Once the split method is disclosed, I will inform you.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Tue May 15, 2018 6:25 am

One more thing, we are testing in trial version.

manjudupi
 
Posts: 13
Joined: Wed Apr 18, 2018 5:55 pm

Tue May 15, 2018 8:07 am

Thank you very much. I got the issue, while merging I was creating a new presentation,

Presentation MergedFile = new Presentation();

and then appending slides to it. By default the type is Screen4X3, so I was getting the wrong type. I fixed it using,

MergedFile.SlideSize.Type = SlideSizeType.Screen16x9;

It works now, I really appreciate your help and you made my day :)

Thank you

manjudupi
 
Posts: 13
Joined: Wed Apr 18, 2018 5:55 pm

Tue May 15, 2018 8:24 am

Hello,

Thanks for your valuable feedback.
Once the new feature of splitting table is available, I will let you know.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Wed May 16, 2018 5:56 pm

I am facing one more issue,

I have added Spire.Presentation and Spire.XLS to same project (class library). Now I am facing issue with Spire.pdf, there is a conflict. Both Spire.Presentation and Spire.XLS adds references to Spire.pdf. Spire.Presentation is not working now. Please help..

manjudupi
 
Posts: 13
Joined: Wed Apr 18, 2018 5:55 pm

Wed May 16, 2018 7:15 pm

To be specific, I am getting the below warning while rebuilding the project,

3>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2041,5): warning MSB3277: Found conflicts between different versions of "Spire.Pdf" that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed.

manjudupi
 
Posts: 13
Joined: Wed Apr 18, 2018 5:55 pm

Thu May 17, 2018 1:43 am

Hello manjudupi,

Thank you for contacting us.
Please kindly note that our single product is used respectively. If you want to use two or more products together, you need to choose Spire.Office to avoid incompatibility, and the latest version is Spire.Office Platinum (DLL Only) Version:3.4.2.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Tue May 22, 2018 7:22 am

Hello manjudupi,

How is your issue now?
Your feedback would be greatly appreciated.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Return to Spire.Presentation