Home Backend Development C#.Net Tutorial C# uses Free Spire.Presentation to insert and edit PPT and delete tables

C# uses Free Spire.Presentation to insert and edit PPT and delete tables

Oct 01, 2017 am 07:24 AM
free

The editor found that using the .NET component - Free Spire.Presentation, adding the product DLL file in C# can easily and quickly implement operations such as table insertion, editing and deletion of presentations. Please refer to the specific implementation code below. Article Bar

In modern study and office, we are often exposed to the use of forms, such as various documents, statements, accounts, etc. It is also inevitable to apply various data tables in PPT presentations. For inserting tables into PPT, I found a new method, but I used a free .NET component-Free Spire.Presentation. Adding the product DLL file in C# can easily and quickly implement presentations. Table insertion, editing and deletion operations. If necessary, you can download it at the following URL: https://www.e-iceblue.cn/Downloads/Free-Spire-Presentation-NET.html

1. Insert table

Step 1: Create a PowerPoint document


  Presentation ppt = new Presentation();
   ppt.SlideSize.Type = SlideSizeType.Screen16x9;
Copy after login

Step 2: Initialize an ITable instance and specify the position, number of rows and columns number, row height and column width                                                                                                                                                                                                     ​Declare and initialize a String[,] array                                                                                                                                                                 The following PPT document effect


2. Delete table rows and columns

Step 1: Initialize a Presentation Instance and load a PowerPoint document


double[] widths = new double[] { 100, 100, 100, 100, 100 };
   double[] heights = new double[] { 15, 15, 15, 15, 15 };
   ITable table = ppt.Slides[0].Shapes.AppendTable(80, 80, widths, heights);
Copy after login

Step 2: Get the table on the first slide


 table.StylePreset = TableStylePreset.LightStyle1Accent2;
Copy after login

Steps Three: Delete the fourth column and fourth row                                                                                                                                                                              

3. Delete the table

Step 1: Initialize a Presentation instance and load a PowerPoint document​​​​​


 string[,] data = new string[,]
{
   {"排名","姓名", "销售额","回款额","工号"},
   {"1","李彪","18270","18270","0011"},
   {"2","李娜","18105","18105","0025"},
   {"3","张丽","17987","17987","0008"},
   {"4","黄艳","17790","17790","0017"},
};
Copy after login

Step 2: Initialize a List object, the element type is IShape                                                                           table graphic and add it to the List                                                                                                                                                                                          ​#Step 5: Save the document


 ppt.SaveToFile("创建表格.pptx", FileFormat.Pptx2010);
Copy after login

Summary

The above is the detailed content of C# uses Free Spire.Presentation to insert and edit PPT and delete tables. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

ChatGPT now allows free users to generate images by using DALL-E 3 with a daily limit ChatGPT now allows free users to generate images by using DALL-E 3 with a daily limit Aug 09, 2024 pm 09:37 PM

DALL-E 3 was officially introduced in September of 2023 as a vastly improved model than its predecessor. It is considered one of the best AI image generators to date, capable of creating images with intricate detail. However, at launch, it was exclus

What are the advanced uses of the free command in Linux? What are the advanced uses of the free command in Linux? Feb 20, 2024 am 09:18 AM

In Linux systems, the free command is an important system tool used to monitor system memory usage. It provides basic usage to view information such as total memory, used amount, and available amount. In addition, there are some advanced uses, such as displaying detailed memory information, unit conversion, and real-time monitoring of memory. Basic usage of the free command: The basic syntax of the free command is as follows: free [options] Here are some commonly used options: -h: Display the memory size in a human-readable manner. -b: Display memory size in bytes. -k: Display memory size in kilobytes. -m: Display memory size in megabytes. -g: Display memory size in gigabytes. Sample Code: Let’s go through the sample code

Deepin V23 RC2 arrives with tweaks galore and optimizations aplenty Deepin V23 RC2 arrives with tweaks galore and optimizations aplenty Jun 28, 2024 am 07:45 AM

The AI-enabled Deepin Linux distro has just received its latest update, dubbed V23 RC2. This version of Deepin comes with a number of package updates and new features. But it's not all about the features; the look and feel are the main spotlight of t

Check if Linux system memory usage is exhausted? These 5 commands are awesome! Detailed explanation! Check if Linux system memory usage is exhausted? These 5 commands are awesome! Detailed explanation! Feb 23, 2024 pm 06:40 PM

In Linux systems, there are various commands you can use to check your system's memory usage to help identify potential memory exhaustion issues. Here are five commonly used commands that can be used to check the memory usage of Linux systems with detailed instructions: free command: The free command is used to display the usage and idle status of system memory. Run the free command to get the total memory, used memory, free memory, and cache and buffer usage. Command example: free -h, this command will display memory usage in human-readable format. top command: The top command is a utility that dynamically monitors system resources, including memory usage. After running the top command, you can view the processes that occupy the most memory in the system and the

How to use the free command in linux How to use the free command in linux May 13, 2023 pm 06:01 PM

In Linux, free is a built-in command to check the memory usage status. It can display the usage of system physical memory, virtual memory (swap partition), shared memory and system cache. The syntax is "free [option]"; the output of the free command Very similar to the memory part of the top command. Linuxfree command: Check the memory usage status The free command is used to display the system memory status, including the usage of system physical memory, virtual memory (swap partition), shared memory and system cache. Its output is very similar to the memory part of the top command. The basic format of the free command is as follows: #free [options] Table 1 lists the commonly used options of this command and their respective meanings. Table 1f

Free PlayStation Plus games for September 2024 revealed by Sony Free PlayStation Plus games for September 2024 revealed by Sony Aug 29, 2024 pm 02:34 PM

For many gamers, next month marks the beginning of this year’s gaming season, even though fall is still a few more weeks away. Fittingly, PlayStation owners with an active PS Plus subscription will soon be able to grab three games for their PlayStati

Deal | Samsung gives away free Odyssey G3 gaming monitors with 44%-off Odyssey G9 and Ark OLED and mini-LED displays Deal | Samsung gives away free Odyssey G3 gaming monitors with 44%-off Odyssey G9 and Ark OLED and mini-LED displays Sep 13, 2024 pm 03:15 PM

Samsung's Odyssey G9 gaming monitor range offers some of the best — and most expensive— high-refresh OLED and mini-LED gaming monitors around. Fortunately, a current sale on Samsung's site has brought those exorbitant prices down by as much as 46%. T

Microsoft gives away very popular RPG adventure game Microsoft gives away very popular RPG adventure game Sep 07, 2024 am 06:39 AM

Hero of the Kingdom II is an adventure game with RPG elements in which players take on the role of a simple farmer who lives with his sister in a quiet village. But the idyll is soon disturbed by pirate raids, whereupon they set out to save the kingd

See all articles