Вставить через keep source formatting powerpoint
Я пытаюсь скопировать и вставить диапазон из документа Excel в слайд PowerPoint, используя VBA. Кажется, что все работает отлично, за исключением того, что оно копирует диапазон как изображение, а не просто форматирует исходное. Я хочу, чтобы он просто сохранил исходное форматирование, когда он копирует и вставляет его. Спасибо за помощь!
Попробуйте это решение вместо использования метода Shapes.PasteSpecial :
Это не создает ссылку на документ Excel, в нее встроена локальная копия документа в презентации PowerPoint. Кажется, я понимаю, что это ваше требование.
Давайте разберем эту проблему на несколько частей:
-
Создание приложения PowerPoint Копирование графиков Вставка Графики как правильный формат.
Теперь, глядя на ваш код, вы довольно хороши, чтобы перейти к первым двум. Это вставка объекта, вызывающего проблему. Давайте рассмотрим различные способы вставки.
ИСПОЛЬЗОВАНИЕ МЕТОДА EXECUTEMSO:
Когда мы используем этот метод, мы как будто щелкаем правой кнопкой мыши на слайде и вставляем объект на слайд. Теперь, когда этот метод является полностью допустимым способом вставки, достижение этого в VBA может быть немного сложным. Причина в том, что он чрезвычайно изменчив, и мы должны замедлить наш сценарий до скорости улитки!
Чтобы реализовать этот метод вместе с любым из его различных параметров, сделайте следующее:
Теперь, если вы посмотрите на мой код, мне пришлось приостановить его два раза, чтобы убедиться, что он будет работать. Это потому, что VBA будет двигаться слишком быстро, иначе все, что произойдет, это вставит все объекты на первом слайде! Если мы делаем только одну пасту, мы обычно в безопасности, не ставя пауз, но в ту минуту, когда вы захотите перейти к новому слайду, вставьте паузы!
ИСПОЛЬЗОВАНИЕ МЕТОДА РЕГУЛЯРНОЙ ПАСТЫ:
Когда мы используем этот метод, мы нажимаем Crtl + V, и он просто вставляет объект как обычную фигуру в PowerPoint. Обычная форма означает тип вставки по умолчанию в PowerPoint. Вот как мы можем реализовать простой метод вставки:
ИСПОЛЬЗОВАНИЕ ПАСТОВОГО СПЕЦИАЛЬНОГО МЕТОДА:
Когда мы используем этот метод, мы нажимаем Ctrl + Alt + V на клавиатуре, и мы получаем все возможные варианты его вставки. Он варьируется от картинки до встроенного объекта, который мы можем связать с исходной рабочей книгой.
При использовании специального метода вставки иногда нам все равно приходится приостанавливать наши сценарии. Причина, по которой я упомянул выше, VBA непостоянна. То, что мы копируем его, не означает, что он попадет в наш буфер обмена. Эта проблема может всплывать, а затем исчезать одновременно, поэтому лучше всего сделать паузу в нашем скрипте, чтобы дать VBA достаточно времени для помещения информации в буфер обмена. Обычно это не длинная пауза, а только секунда или 2. Вот как мы реализуем специальный метод вставки с различными опциями, которые мы можем использовать:
С учетом всего вышесказанного, если вы вставляете объект как объект OLEObject со ссылкой, большую часть времени его форматирование завершается. Если у вас нет специальной темы, которая существует только в Excel, то здесь вы попадаете в неприятности. Я столкнулся с этой проблемой, когда брал диаграмму из Excel в Word, но у диаграммы Excel была собственная тема.
Вот ваш код, переписанный так, чтобы он вставлял объект, используя исходный формат и устанавливая его размеры. Надеюсь, вы не возражаете, чтобы я скорректировал часть вашего кода, чтобы сделать его немного более кратким.
I had to restore my PC to a February 2015 image after a blue screen crash. PowerPoint 2007 no longer has "Keep source formatting" options that showed up at the last slide after pasting slides from one presentation to another. There is also no "Keep source formatting" under Paste special.
I've run Windows and Office Update, everything is up to date, but still no "Keep source formatting" option. The Paste special option is showing, but the only choice is "slide" or "link". Nothing else. The Paste Special Button seems to have everything in Word and Excel 2007, but not PowerPoint. I'm using Windows 7 Professional. How do I restore this option?
This thread is locked. You can follow the question or vote as helpful, but you cannot reply to this thread.
Report abuse
Harassment is any behavior intended to disturb or upset a person or group of people. Threats include any threat of suicide, violence, or harm to another. Any content of an adult theme or inappropriate to a community web site. Any image, link, or discussion of nudity. Any behavior that is insulting, rude, vulgar, desecrating, or showing disrespect. Any behavior that appears to violate End user license agreements, including providing product keys or links to pirated software. Unsolicited bulk mail or bulk advertising. Any link to or advocacy of virus, spyware, malware, or phishing sites. Any other inappropriate content or behavior as defined by the Terms of Use or Code of Conduct. Any image, link, or discussion related to child pornography, child nudity, or other child abuse or exploitation.
Replies (11)
* Please try a lower page number.
* Please enter only numbers.
* Please try a lower page number.
* Please enter only numbers.
First thing to try:
Office Button > PowerPoint Options > Advanced
In the Cut Copy paste section you can select / deselect "Show Paste Options Button"
Report abuse
Harassment is any behavior intended to disturb or upset a person or group of people. Threats include any threat of suicide, violence, or harm to another. Any content of an adult theme or inappropriate to a community web site. Any image, link, or discussion of nudity. Any behavior that is insulting, rude, vulgar, desecrating, or showing disrespect. Any behavior that appears to violate End user license agreements, including providing product keys or links to pirated software. Unsolicited bulk mail or bulk advertising. Any link to or advocacy of virus, spyware, malware, or phishing sites. Any other inappropriate content or behavior as defined by the Terms of Use or Code of Conduct. Any image, link, or discussion related to child pornography, child nudity, or other child abuse or exploitation.
Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
Yes, the "Show Paste Options buttons" is checked, it shows up on the ribbon, however, there is no "Keep source formatting" option. The only choices are"slide" or "link".
Report abuse
Harassment is any behavior intended to disturb or upset a person or group of people. Threats include any threat of suicide, violence, or harm to another. Any content of an adult theme or inappropriate to a community web site. Any image, link, or discussion of nudity. Any behavior that is insulting, rude, vulgar, desecrating, or showing disrespect. Any behavior that appears to violate End user license agreements, including providing product keys or links to pirated software. Unsolicited bulk mail or bulk advertising. Any link to or advocacy of virus, spyware, malware, or phishing sites. Any other inappropriate content or behavior as defined by the Terms of Use or Code of Conduct. Any image, link, or discussion related to child pornography, child nudity, or other child abuse or exploitation.
1 person found this reply helpful
Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
Report abuse
Harassment is any behavior intended to disturb or upset a person or group of people. Threats include any threat of suicide, violence, or harm to another. Any content of an adult theme or inappropriate to a community web site. Any image, link, or discussion of nudity. Any behavior that is insulting, rude, vulgar, desecrating, or showing disrespect. Any behavior that appears to violate End user license agreements, including providing product keys or links to pirated software. Unsolicited bulk mail or bulk advertising. Any link to or advocacy of virus, spyware, malware, or phishing sites. Any other inappropriate content or behavior as defined by the Terms of Use or Code of Conduct. Any image, link, or discussion related to child pornography, child nudity, or other child abuse or exploitation.
Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
I don't think there was ever a "keep source format" in Paste Special dialog in 2007. In 2010 it appears in the menu (not in the pop up dialog you are showing)
Report abuse
Harassment is any behavior intended to disturb or upset a person or group of people. Threats include any threat of suicide, violence, or harm to another. Any content of an adult theme or inappropriate to a community web site. Any image, link, or discussion of nudity. Any behavior that is insulting, rude, vulgar, desecrating, or showing disrespect. Any behavior that appears to violate End user license agreements, including providing product keys or links to pirated software. Unsolicited bulk mail or bulk advertising. Any link to or advocacy of virus, spyware, malware, or phishing sites. Any other inappropriate content or behavior as defined by the Terms of Use or Code of Conduct. Any image, link, or discussion related to child pornography, child nudity, or other child abuse or exploitation.
Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
I was using "keep source format" weekly making PowerPoints, copying slides from one presentation to another. As I pasted slides into a new presentation, a menu would pop up at the bottom of the last pasted slide with buttons to choose, "*keep source format? "*Use format of this presentation? or *something else (I don't remember). This menu showed each time a pasted slides from another presentation into a new one.
This feature appeared in my PowerPoint 2007 at least a year ago. Since I restored my laptop, the feature is gone. I was really happy when the feature appeared, because it was a great time saver. Without the "keep source format", pasting slides from presentations with different formats, they lose the format in a new presentation and I have to format them slide by slide.
I would not have know about this feature if I hadn't used it for at least a year in PowerPoint 2007.
Report abuse
Harassment is any behavior intended to disturb or upset a person or group of people. Threats include any threat of suicide, violence, or harm to another. Any content of an adult theme or inappropriate to a community web site. Any image, link, or discussion of nudity. Any behavior that is insulting, rude, vulgar, desecrating, or showing disrespect. Any behavior that appears to violate End user license agreements, including providing product keys or links to pirated software. Unsolicited bulk mail or bulk advertising. Any link to or advocacy of virus, spyware, malware, or phishing sites. Any other inappropriate content or behavior as defined by the Terms of Use or Code of Conduct. Any image, link, or discussion related to child pornography, child nudity, or other child abuse or exploitation.
I have an table in powerpoint, without any cells coloured. Now I updated my excel sheets, colouring certain cells and now I just want to copy this data with the cell colouring into the table in powerpoint, but somehow it only copies the content and not the cell colouring (even when pasting with keep source formatting). Does anyone have a solution for this? It's costing me a lot of time to colour everything in Powerpoint myself.
Using Office 2013 by the way. Thx in advance,
This thread is locked. You can follow the question or vote as helpful, but you cannot reply to this thread.
Report abuse
Harassment is any behavior intended to disturb or upset a person or group of people. Threats include any threat of suicide, violence, or harm to another. Any content of an adult theme or inappropriate to a community web site. Any image, link, or discussion of nudity. Any behavior that is insulting, rude, vulgar, desecrating, or showing disrespect. Any behavior that appears to violate End user license agreements, including providing product keys or links to pirated software. Unsolicited bulk mail or bulk advertising. Any link to or advocacy of virus, spyware, malware, or phishing sites. Any other inappropriate content or behavior as defined by the Terms of Use or Code of Conduct. Any image, link, or discussion related to child pornography, child nudity, or other child abuse or exploitation.
Replies (7)
Thank you for posting your query in Microsoft Office Community.
Let's try following steps and check if it helps.
1. Copy the content from Excel.
2. Open PowerPoint, go to Home tab, click on Paste>Paste Special.
3. Select Paste link>Microsoft Excel Worksheet Object and press Ok.
Now whatever update you make in Excel would reflect in Excel as well.
Hope the above information helps. Try the suggestions and let me know the result at your earliest convenience.
Report abuse
Harassment is any behavior intended to disturb or upset a person or group of people. Threats include any threat of suicide, violence, or harm to another. Any content of an adult theme or inappropriate to a community web site. Any image, link, or discussion of nudity. Any behavior that is insulting, rude, vulgar, desecrating, or showing disrespect. Any behavior that appears to violate End user license agreements, including providing product keys or links to pirated software. Unsolicited bulk mail or bulk advertising. Any link to or advocacy of virus, spyware, malware, or phishing sites. Any other inappropriate content or behavior as defined by the Terms of Use or Code of Conduct. Any image, link, or discussion related to child pornography, child nudity, or other child abuse or exploitation.
33 people found this reply helpful
Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
You can preserve this formatting if:
- You create a Theme file with a set of predefined colors, then apply this to both the Excel and PowerPoint files.
- You create the cell shading colors out of variants on the theme colors.
Once both files are using the same theme, colors should transfer without any issues.
Report abuse
Harassment is any behavior intended to disturb or upset a person or group of people. Threats include any threat of suicide, violence, or harm to another. Any content of an adult theme or inappropriate to a community web site. Any image, link, or discussion of nudity. Any behavior that is insulting, rude, vulgar, desecrating, or showing disrespect. Any behavior that appears to violate End user license agreements, including providing product keys or links to pirated software. Unsolicited bulk mail or bulk advertising. Any link to or advocacy of virus, spyware, malware, or phishing sites. Any other inappropriate content or behavior as defined by the Terms of Use or Code of Conduct. Any image, link, or discussion related to child pornography, child nudity, or other child abuse or exploitation.
3 people found this reply helpful
Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
As John says if you have the same theme and copy over the whole table it should be fine.
It sounds like you are copying cell data and pasting the values into an existing table in PPT. I don't think there is any way to retain the added format if you do this. (Happy to be wrong!)
Report abuse
Harassment is any behavior intended to disturb or upset a person or group of people. Threats include any threat of suicide, violence, or harm to another. Any content of an adult theme or inappropriate to a community web site. Any image, link, or discussion of nudity. Any behavior that is insulting, rude, vulgar, desecrating, or showing disrespect. Any behavior that appears to violate End user license agreements, including providing product keys or links to pirated software. Unsolicited bulk mail or bulk advertising. Any link to or advocacy of virus, spyware, malware, or phishing sites. Any other inappropriate content or behavior as defined by the Terms of Use or Code of Conduct. Any image, link, or discussion related to child pornography, child nudity, or other child abuse or exploitation.
Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
Thx for your reply. Though I'm not really looking for a direct link between those programs, As i might need to filter some variables every now and then and don't want that to be reflected in Powerpoint. I just want to copy-paste contents and formatting from a table in excel to an existing table in Powerpoint. Neither is the option to set up teams, since the colouring has a specific meaning.
To be more clear.
I copied data from Excel to Powerpoint, then I 'designed' the tables which was fine. After having done multiple tables I realized I had to colour certain cells (f.e. green when score is above 10 and red when below 0), which I applied in Excel since that worked fastest. But than trying to paste the data from excel with the right colouring in the existing tables in powerpoint, I wasn't able to keep formatting. Having to colour every cell myself.
So is there any way to just copy and paste? (like you can copy and pasta data incl. formatting within excel)
Report abuse
Harassment is any behavior intended to disturb or upset a person or group of people. Threats include any threat of suicide, violence, or harm to another. Any content of an adult theme or inappropriate to a community web site. Any image, link, or discussion of nudity. Any behavior that is insulting, rude, vulgar, desecrating, or showing disrespect. Any behavior that appears to violate End user license agreements, including providing product keys or links to pirated software. Unsolicited bulk mail or bulk advertising. Any link to or advocacy of virus, spyware, malware, or phishing sites. Any other inappropriate content or behavior as defined by the Terms of Use or Code of Conduct. Any image, link, or discussion related to child pornography, child nudity, or other child abuse or exploitation.
I'm trying to copy and paste a range from an Excel document into a PowerPoint slide.
It is copying the range as an image rather than keeping source formatting.
which version of Office you run? your code (except some missing lines) looks and works fine. I have OLE Shape with excel range in PP presentation as required. All formatting is kept as in source range.
I'm using 2010. Everything works except when it copies over, it copies some borders of the Excel range. I need to copy with source formatting without all the borders of the cell.
is it possible when you do so manually, without vba? I'm not sure. I think you need to change cells borders formatting in your source excel file.
How would I go about doing this? I tried it on PowerPoint using keep source formatting and it worked.
6 Answers 6
Let’s break this problem into a few different parts:
- Creating the PowerPoint Application
- Copying the Charts Pasting the
- Charts as the right format.
Now looking at your code, you are pretty much good to go on the first two. It’s pasting the object that is causing the problem. Let’s explore the different ways to paste.
USING THE EXECUTEMSO METHOD:
When we use this method it’s like we are right-clicking on the slide and pasting the object on to the slide. Now while this method is a completely valid way to paste, achieving this in VBA can be a little challenging. The reason why is because it is extremely volatile, and we must slow down our script to a snail’s pace!
To implement this method along with any of its different options, do the following:
Now if you look at my code, I had to pause it two different times to make sure it would work. This is because VBA will move way too fast otherwise and all that will happen is it will paste all the objects on the first slide! If we are only doing one paste we are usually safe without putting in the pauses, but the minute you want to go to a new slide put the pauses in!
USING THE REGULAR PASTE METHOD:
When we use this method, it’s like we are pressing Crtl+V and it will simply paste the object as a regular shape in PowerPoint. The regular shape means the default paste type in PowerPoint. Here is how we can implement a simple paste method:
USING THE PASTE SPECIAL METHOD:
When we use this method it’s like we are pressing Ctrl + Alt + V on the keyboard and we get all sorts of different options of how to paste it. It ranges from a picture all the way to an embedded object that we can link back to the source workbook.
With the paste special method, sometimes we will still have to pause our scripts. The reason why is like the reason I mentioned above, VBA is volatile. Just because we copy it doesn’t mean it will make it to our clipboard. This problem can pop up and then disappear at the same time, so our best bet is to have a pause in our script to give VBA enough time to put the information in the clipboard. It usually doesn’t have to be a long pause but only a second or 2. Here is how we implement the paste special method with the different options we can use:
With all that being said, if you paste an object as an OLEObject with a link most of the time the formatting comes over with it. Unless you have a special theme that only exist in Excel, that’s where you get into trouble. I ran into this problem when I was taking a chart from Excel To Word, but the Excel chart had a custom theme.
Here is your code, rewritten so that it will paste an object using the source format and setting the dimensions of it. I hope you don't mind me readjusting some of your code to make it a little more concise.
Is it possible to embed programming source code to Powerpoint slide, and keep code highlighting/coloring?
11 Answers 11
After pasting, a small "Paste Options" icon appears below the pasted text.
Click this icon and choose "Keep Source Formatting" :
I don't see such a Paste Options icon. I don't see a button to give me these options. I'm using PowerPoint:mac 2011. I think I have seen it in Windows versions, however.
I tried different suggested methods and tools to copy from, but was actually missing that word/powerpoint was messing up the format by using "Destination Theme". Thanks!
Use Notepad++ with add-on NppExport.
Select the source code
Use Copy RTF to clipboard of NppExport
Paste into empty PPT slide (do not select any textfiled)
With version 6.9.2 or higher it's working without NppExport plugin. Just make right-click on the selected text -> Plugin commands -> Copy Text with Syntax Highlighting.
Pygments can format almost every format to rtf:
Thanks for this. I got very favorable results with pygmentize -O style=paraiso-dark -f rtf -l aspx-cs Index.cshtml | pbcopy for syntax highlighting of a Razor view for use in a presentation.
Adding to what @ChristianLong suggested, but for Linux: pygmentize -f rtf code.py | xclip -sel clip . Note that you will probably have to install xclip.
If the source code does not need to be copied and pasted out of the presentation, a quick and dirty solution could be to simply take screenshots of the source code.
This also has the drawback that once screenshot, it is no longer possible to resize the column width. This becomes a problem if you try to fit a 80 column printout into a 2x1 horizontal slide layout, a 132 column source into a 1x2 vertical layout, for example. The pygmentize answer above doesn't suffer from this.
- Click on Insert → Object → OpenDocument Text
- Paste on opened panel
- Click outside.
Note: Copying from Notepad++ will preserve colors and styling.
Doesn't work for power point 2010. I copied text from Notepad++ to Power point presentation but it looses colors and styling.
Here's another approach:
- Find an online source code syntax highlighting service.
- Paste the code to highlight into the web site.
- Copy the highlighted version.
- Create a new Word document.
- Paste the code into Word (note the background colours may be lost).
- Copy the code from Word.
- Create a new text area in PowerPoint.
- Click the Home menu option.
- Open Paste on the ribbon.
- Select Keep source formatting.
- Optionally, change the text area background colour to taste.
Adjust the font using Inconsolata or other monospace font.
But after pasting into PowerPoint presentation new lines and line spacing is lost, so we can take a screen shot of the preview and paste it in our PowerPoint presentation
Copy the code and first paste that code into Microsoft word
Then do the formatting if necessary and then copy from word and paste back to powerpoint by right clicking and choosing use destination theme
This was the only way that I could copy and paste code from IntelliJ (a special program used for writing code)
Pasting from Eclipse should retain formatting if the app supports it. I know Word does. not sure about PPT.
Works from Eclipse Juno to Word 2010, but not to Powerpoint 2010 - it loses the colours and converts some of them to bold text
I've had no success pasting into Powerpoint 2010 on Windows.
However, pasting from Eclipse into Word 2010 works.
You can then save this formatted text as an RTF file, then embed the RTF into a Powerpoint 2010 slide using Insert Object (and optionally select 'link' so you can edit and update the text in Word).
Using Notepad++ and Npp Export works great, but your text will end up with a white background.
To remove it, paste first the text in word with the "preserve source formatting" option. Then, select the text and in Home > Font, remove the background with the Text Highlight Color option.
Then, copy again the text from word, and paste it in powerpoint with the "preserve source formatting" option.
Highly active question. Earn 10 reputation (not counting the association bonus) in order to answer this question. The reputation requirement helps protect this question from spam and non-answer activity.
Not the answer you're looking for? Browse other questions tagged microsoft-powerpoint source-code or ask your own question.
Related
Hot Network Questions
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
Site design / logo © 2022 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2022.5.9.42071
Читайте также: