ale mal by som este jednu otazku :)
preco ked nastavim:
oPP.Visible = False
tak process skonci pritom a nepokracuje dalej?
Jeza.m: Mna ani nenapadlo ze prikaz Quit je urceny pre uplne vsetky instancie .... a mate pravdu ako som ho vyhodil z prikazov tak to funguje tak ako som chcel
tu je kod:
Dim aSaveFileDialog As New SaveFileDialog
aSaveFileDialog.Filter = "PowerPoint file|*.pptx"
aSaveFileDialog.Title = "Save an slide"
aSaveFileDialog.ShowDialog()
If aSaveFileDialog.FileName <> "" Then
Dim oPP As PowerPoint.Application = New PowerPoint.Application
Dim oPres As Presentation
Globals.ThisAddIn.Application.ActivePresentation.SaveCopyAs(aSaveFileDialog.FileName)
oPP.Visible = True
oPres = oPP.Presentations.Open(aSaveFileDialog.FileName)
For x = oPres.Slides.Count To 1 Step -1
If oPres.Slides(x).Name <> Globals.ThisAddIn.Application.ActiveWindow.Selection.SlideRange.Name Then oPres.Slides(x).Delete()
Next
oPres.Close()
oPP = Nothing
End If
dakujem za rady :)
Dalda, DAAL: Tak som to skusal ale aj tak to vypne otvorenu prezentaciu ale aj aktualnu prezentaciu.
netusim v com robim chybu. tu je kod:
Private Sub aTest()
Dim aSaveFileDialog As New SaveFileDialog
aSaveFileDialog.Filter = "PowerPoint file|*.pptx"
aSaveFileDialog.Title = "Save an slide"
aSaveFileDialog.ShowDialog()
If aSaveFileDialog.FileName <> "" Then
Dim oApp As ppt.Application = New ppt.Application
Dim oPres As ppt.Presentation
oApp.Visible = Microsoft.Office.Core.MsoTriState.msoFalse
Globals.ThisAddIn.Application.ActivePresentation.SaveCopyAs(aSaveFileDialog.FileName)
oPres = oApp.Presentations.Open(aSaveFileDialog.FileName)
For x = oPres.Slides.Count To 1 Step -1
If oPres.Slides(x).Name <> Globals.ThisAddIn.Application.ActiveWindow.Selection.SlideRange.Name Then oPres.Slides(x).Delete()
Next
GC.Collect()
GC.WaitForPendingFinalizers()
GC.Collect()
GC.WaitForPendingFinalizers()
oPres.Save()
oPres.Close()
Marshal.FinalReleaseComObject(oPres)
oApp.Quit()
Marshal.FinalReleaseComObject(oApp)
End If
End Sub
Ahojte,
Prekopavam sa tym visual studio a zas som narazil na zadrhel.
problem je ze ked si vytvorim instanciu v tej instancii otvorim powerpoint subor a nakoniez avrem powerpoint subor a aj instanciu. Tak sa vypnu vsetky powerpoin subory.
netusite preco?
Zdroj mojho kodu:
Dim oApp As _Application = New PowerPoint.Application
Dim oPres As PowerPoint.Presentation
oApp.Visible = True
oPres = oApp.Presentations.Open("C:\test.pptx")
oPres.Save()
oPres.Close()
oPres = Nothing
oApp.Quit()
oApp = Nothing
tak uz som to vyriesil :)
treba si vytvorit jednu entry na vymazanie a druhu entry na zapisovanie a potom to pojde :)
mozno niekto ma lepsie riesenie al ja osobne som ine nenasiel
tu je priklad:
Dim zipPath As String = "test.pptx"
Dim entry As ZipArchiveEntry = Nothing
Dim entry2 As ZipArchiveEntry = Nothing
Dim doc As XmlDocument = New XmlDocument
Using zipToOpen As FileStream = New FileStream(zipPath, FileMode.Open)
Using archive As ZipArchive = New ZipArchive(zipToOpen, ZipArchiveMode.Update)
entry = archive.GetEntry("docProps/core.xml")
Using stmZip As Stream = entry.Open
doc.Load(stmZip)
doc.Item("cp:coreProperties").Item("dc:title").InnerText = "test"
End Using
entry2 = archive.CreateEntry("docProps/core.xml")
entry.Delete()
Using stmZip As Stream = entry2.Open
doc.Save(stmZip)
End Using
End Using
End Using
este priloha:
Ahojte,
zas mam problem :)
uz som zistil:
- ako sa da otvorit zip subor
- ako zo zipka si setnut subor a pracovat s nim
- tak isto ako ziskavat udaje zo subora
jediny problem mam ze netusim ako taky subor prepisat
tu je kod na prepisovanie ale robi duplicitu:
Imports System.Xml
Dim zipPath As String = "test.pptx"
Dim entry As ZipArchiveEntry = Nothing
Dim doc As XmlDocument = New XmlDocument
Using zipToOpen As FileStream = New FileStream(zipPath, FileMode.Open)
Using archive As ZipArchive = New ZipArchive(zipToOpen, ZipArchiveMode.Update)
aGetThumbnail = Image.FromStream(archive.GetEntry("docProps/thumbnail.jpeg").Open)
entry = archive.GetEntry("docProps/core.xml")
Using stmZip As Stream = entry.Open
doc.Load(stmZip)
doc.Item("cp:coreProperties").Item("dc:title").InnerText = "test"
doc.Save(stmZip)
End Using
End Using
End Using
neviete kde robim chybu???
tak som sa nato pozrel a mali ste pravdu ja som to pisal do zleho eventu
mal som ist do ThisAddin.vb a tam si vytvorit event Application_WindowActivate Ten sa zapne vzdy pri starte a tam uz isiel tento kod
dakujem zarady >|
DAAL dik za reakciu. Pretoze tento Event za zapina hned pri starte powerpointu a ja potrebujem nastavit uzivatelovi standartne nejake farby pri pusteni powerpointu.
ale Problem je ze tento Event sa zapne skor ako PowerPoint. Tj. este v tej dobe nemoze prepisat ExtraColor.
Teraz som vo Viedni ked budem v BA tak si urcite tie Vase linky precitam.
Aj ked zapisat to do ineho eventu som skusal ale marne. Mozno ze som robil nieco zle :)
dam potom vediet
tak uz som to vyresil :)
je to pisane v visual studio a treba tam dodat referencie na:
System.IO.Compression
System.IO.Compression.FileSystem
aj ked ich Importnete tak to nebude stacit musite ich tam dodat cez Project/add reference
a program funguje takto
Imports System.Drawing
Imports ppt = Microsoft.Office.Interop.PowerPoint
Imports System.IO
Imports System.IO.Compression
Public Class atest
Dim pres As ppt.Presentation
Dim bmp As Bitmap
Dim sld As ppt.Slide
Private Sub atest_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim zipPath As String = "C:\Data\PowerPoint 2016\Presentations\test.potx"
Dim entry As ZipArchiveEntry
Dim MS As MemoryStream
Using archive As ZipArchive = ZipFile.OpenRead(zipPath)
entry = archive.GetEntry("docProps/thumbnail.jpeg")
MS = New MemoryStream
Using stmZip As Stream = entry.Open
stmZip.CopyTo(MS)
End Using
PictureBox1.Image = Image.FromStream(MS)
End Using
End Sub
End Class
k tomuto priloha ani nejde dat ale mozem dat obrazok o co mi vlasne ide.
.... zobrazovanie tohoto obrazku je mi podstatne jedno kde ten kod by som aj tak nakoniec chcel pouzit v visual studio 2015
hadam to bude teraz jasnejsie
keby ste mali este nejake otazky pytajte sa :) stale som nato nedosiel
Jedna sa o uvodny obrazok co ukazuje zamisto ikony suboru. Takyto subor sa nachadza v powerpointe subore. Ked premenujete subotr na zip tak tam ho najdete.
a moja otazka znie ako tento subor zobrazit v imageboxe .... vie niekto ako nato?? na intewrnete som nasiel len platen aplikacie nic free
Ahojte poradaci,
mam problem s zmenenim extraColors pri evente ribbon_load
ten prikaz samozrejme funguje spravne len v tomto evente sa sprava ako keby este nebol nacitany addins. Takze to nenacita a ani neukaze chybova hlasku.
tu je presny kod co nefunguje:
Private Sub Ribbon_Load(sender As Object, e As RibbonUIEventArgs) Handles MyBase.Load
With Globals.ThisAddIn.Application.ActivePresentation.ExtraColors
.Clear()
.Add(RGB(0, 100, 200))
.Add(RGB(0, 100, 100))
.Add(RGB(0, 50, 100))
End With
End Sub
netusite ako nacitam extracolors pri starte addinsu??
dakujem nakoniec som to vyriesil tak ze ked sa userform zavre tak az potom refreshne items v ribborne :)
co uplne staci
Ahojte poradaci,
Zas som sa zasekol pri niecom :)
Potreboval by som nejakym sposobom zasetovat ribbon tak aby som napr. z winformu mohol upravovat na ribborne prvky ako ribbonmenu atd.
skusal som:
Dim aRibbon As New Ribbon
aRibbon.aCreateRibbonButton("ApplyNewTemplate")
aCreateRibbonButton je sub v ribborne .... ale ked toto spravim aj ked prebehne procedura nic sa na ribborne neurobi.
mne to pride ze vytvori nejaku uplne novu instanciu a preto to nic v starej instancii nevidim
vedel by niekto ako mam zassetovat staru instanciu aby som mohol aj odniekal inam menit na ribborne prvky???
Oblíbený formulář Faktura byl vylepšen a rozšířen.
Více se dočtete zde.
Používáte podnikový systém Helios iNuvio? Potřebujete pomoci se správou nebo vyvinout SQL proceduru? Více informací naleznete na stránce Helios iNuvio.