Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

konvertovanje vise html-a u vise word dokumenta

[es] :: Office :: Word :: konvertovanje vise html-a u vise word dokumenta

Strane: 1 2

[ Pregleda: 4315 | Odgovora: 25 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

vojvoda1010
nezaposlen

Član broj: 310516
Poruke: 547
82.208.214.*



+2 Profil

icon konvertovanje vise html-a u vise word dokumenta08.09.2018. u 11:34 - pre 67 meseci
imam u folderu vise html dokumenta koje preba pa prebacim u word dokumente.

da li postoji kovertor za ovako nesto ili VBA code?

 
Odgovor na temu

bokinet

Član broj: 29844
Poruke: 574



+50 Profil

icon Re: konvertovanje vise html-a u vise word dokumenta08.09.2018. u 15:41 - pre 67 meseci
HTML stranice se mogu otvoriti u MS Word i iste mogu da se edituju.

Problem je u kompleksnosti HTML sadrzaja koji moze da se nalazi na samoj HTML strani (tj. stranicama) i konverzije u MS Word. Na to utice dosta faktora od stilova pa do velicine sadrzaja...

U svakom slucaju, neki postupak bi bio:

1. Otvori se html file u MS Word;

2. Snimi se kao MS Word dokument sa SAVE AS ili sa EXPORT komandom;

Moze rucno a moze i kroz VBA kod.

Dodatak:
Takodje treba obratiti na multimedijalni sadrzaj koji prati web stranu da li ce se koristi samo URI/URL ka njima ili ces se ubaciti kao sastavni deo MS Word dokumenta isti, prilikom snimanja. Na primer, slike i sl. / embed images i sl.
 
Odgovor na temu

vojvoda1010
nezaposlen

Član broj: 310516
Poruke: 547
82.208.214.*



+2 Profil

icon Re: konvertovanje vise html-a u vise word dokumenta08.09.2018. u 18:12 - pre 67 meseci
a da li moze da se vise html dokumenta automatski otvore i snime u word dokumeta, posto ih imam bas mnogo.

nesto sam ovde nasao ali ne znam

http://www.vbforums.com/showth...-Convert-html-to-word-document
 
Odgovor na temu

bokinet

Član broj: 29844
Poruke: 574



+50 Profil

icon Re: konvertovanje vise html-a u vise word dokumenta08.09.2018. u 18:23 - pre 67 meseci
Moze da se automatizuje ceo proces preko VBA.

Na primer:

1. Napravi se prvo deo koda koji radi sve za jedan dokumenta - recimo f-ja koja ima ulaznu vrednost za lokaciju html file a izlaznu vrednost vraca status. U okviru te f-je vrsi se otvaranje/ucitavanje file-a i eksport u novi file i vrsi promena tipa file-a tj. konverzija;

2. Potom se napravi deo koda koji pravi listu fileova i/ili recimo deo gde se biraju file-ovi koji se konvertuju - sa/bez GUI (grafickog korisnickog interfejsa);

3. Onda se kroz petlju tj. za svaki odabrani file iz liste iz br. 2, poziva deo koda iz br. 1

4. i eventualno generise izvestaj uspesnosti konverzije/eksporta za svaki file-a u vidu poruke ili nekog teksta ili debug info.

Videti recimo komandu DIR u VBA, cemu sluzi i kako se ista koristi kao i ostale komande u VBA.

 
Odgovor na temu

vojvoda1010
nezaposlen

Član broj: 310516
Poruke: 547
82.208.214.*



+2 Profil

icon Re: konvertovanje vise html-a u vise word dokumenta09.09.2018. u 08:38 - pre 67 meseci
Sub SaveAllAsDOCX()

'Search #EXT to change the extensions to save to docx

Dim strDocName As String
Dim strPath As String
Dim oDoc As Document
Dim fDialog As FileDialog
Dim intPos As Integer

'Create a folder dialog
Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)
With fDialog
.Title = "Select root folder and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show <> -1 Then
MsgBox "Cancelled By User", , "List Folder Contents"
Exit Sub
End If

'Select root folder
strPath = fDialog.SelectedItems.Item(1)

'Ensure the Folder Name ends with a "\"
If Right(strPath, 1) <> "\" Then strPath = strPath + "\"

End With

'Close any open documents
If Documents.Count > 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If

'remove any quotes from the folder string
If Left(strPath, 1) = Chr(34) Then
strPath = Mid(strPath, 2, Len(strPath) - 2)
End If

'begin recusion
recurse (strPath)

End Sub

'This method controls the recusion
Function recurse(folder As String)

'save all the files in the current folder
SaveFilesInFolder (folder)

'get all the subfolders of the current folder
Dim folderArray
folderArray = GetSubFolders(folder)

'Loop through all the non-empty elements for folders
For j = 1 To UBound(folderArray)
If folderArray(j) <> "" Then
'begin recusion on subfolder
recurse (folder & folderArray(j) & "\")
End If
Next
End Function

'Saves all files with listed extensions
Function SaveFilesInFolder(folder As String)

'List of extensions to look for #EXT
Dim strFilename As String
extsArray = Array("*.rtf", "*.doc")

'Loop through extensions
For i = 0 To (UBound(extsArray))

'select the 1st file with the current extension
strFilename = Dir(folder & extsArray(i), vbNormal)

'double check the current extension (don't to resave docx files)
Dim ext As String
ext = ""
On Error Resume Next
ext = Right(strFilename, 5)

If ext = ".docx" Or ext = "" Then
'Don't need to resave files in docx format
Else
'Save the current file in docx format
While Len(strFilename) <> 0
Set oDoc = Documents.Open(folder & strFilename)
strDocName = ActiveDocument.FullName
intPos = InStrRev(strDocName, ".")
strDocName = Left(strDocName, intPos - 1)
strDocName = strDocName & ".docx"
oDoc.SaveAs FileName:=strDocName, _
FileFormat:=wdFormatDocumentDefault
oDoc.Close SaveChanges:=wdDoNotSaveChanges

strFilename = Dir
Wend
End If
Next

strFilename = ""
End Function

'List all the subfolders in the current folder
Function GetSubFolders(RootPath As String)
Dim FS As New FileSystemObject
Dim FSfolder As folder
Dim subfolder As Variant


Set FSfolder = FS.GetFolder(RootPath)

'subfolders is variable length
Dim subfolders() As String
ReDim subfolders(1 To 10)

Dim i As Integer
i = LBound(subfolders)
For Each subfolder In FSfolder.subfolders
subfolders(i) = subfolder.Name

'increase the size of subfolders if it's needed
i = i + 1
If (i >= UBound(subfolders)) Then
ReDim subfolders(1 To (i + 10))
End If

Next subfolder

Set FSfolder = Nothing

GetSubFolders = subfolders

End Function





na netu sam nasao pa ne znam da li je to to, doalzim do greske i to u


Function GetSubFolders(RootPath As String)
Dim FS As New FileSystemObject


u vidu compile error:
user-defined type nit defined
 
Odgovor na temu

bokinet

Član broj: 29844
Poruke: 574



+50 Profil

icon Re: konvertovanje vise html-a u vise word dokumenta09.09.2018. u 11:17 - pre 67 meseci
Dodati referencu u Microsoft Scripting RunTime

Menu TOOLS -> REFERENCES, pa u listi pronaci 'Microsoft Scripting RunTime' i odabrati (cekirati).
 
Odgovor na temu

vojvoda1010
nezaposlen

Član broj: 310516
Poruke: 547
82.208.214.*



+2 Profil

icon Re: konvertovanje vise html-a u vise word dokumenta09.09.2018. u 11:55 - pre 67 meseci
sada ne mogu da nadjem gde snima dokumente
 
Odgovor na temu

bokinet

Član broj: 29844
Poruke: 574



+50 Profil

icon Re: konvertovanje vise html-a u vise word dokumenta09.09.2018. u 12:02 - pre 67 meseci
Code:

'Saves all files with listed extensions
Function SaveFilesInFolder(folder As String)

'List of extensions to look for #EXT
Dim strFilename As String
extsArray = Array("*.rtf", "*.doc")

'Loop through extensions
For i = 0 To (UBound(extsArray))

'select the 1st file with the current extension
strFilename = Dir(folder & extsArray(i), vbNormal)

'double check the current extension (don't to resave docx files)
Dim ext As String
ext = ""
On Error Resume Next
ext = Right(strFilename, 5)

If ext = ".docx" Or ext = "" Then
'Don't need to resave files in docx format
Else
'Save the current file in docx format
While Len(strFilename) <> 0
Set oDoc = Documents.Open(folder & strFilename)
strDocName = ActiveDocument.FullName
intPos = InStrRev(strDocName, ".")
strDocName = Left(strDocName, intPos - 1)
strDocName = strDocName & ".docx"
oDoc.SaveAs FileName:=strDocName, _
FileFormat:=wdFormatDocumentDefault
oDoc.Close SaveChanges:=wdDoNotSaveChanges

strFilename = Dir
Wend
End If
Next

strFilename = ""
End Function


Ubaciti iznad koda 'oDoc.SaveAs....' ako treba da se vidi informativno gde je za debug potrebe.

Code:

debug.print now,strDocName

 
Odgovor na temu

vojvoda1010
nezaposlen

Član broj: 310516
Poruke: 547
82.208.214.*



+2 Profil

icon Re: konvertovanje vise html-a u vise word dokumenta09.09.2018. u 12:51 - pre 67 meseci
pokusavam ali ne uspevam

izgleda da nisam na pravom putu
 
Odgovor na temu

bokinet

Član broj: 29844
Poruke: 574



+50 Profil

icon Re: konvertovanje vise html-a u vise word dokumenta09.09.2018. u 14:17 - pre 67 meseci
A sta kazu znakovi pored puta kojim se ide pogresno?

Koje su greske, vrednosti promenljivih i sl. tkz. debug info.?

Malo vise reci ne bi skodilo...

I'm just a messenger, so don't kill a messenger.
 
Odgovor na temu

vojvoda1010
nezaposlen

Član broj: 310516
Poruke: 547
82.208.214.*



+2 Profil

icon Re: konvertovanje vise html-a u vise word dokumenta09.09.2018. u 14:50 - pre 67 meseci
ne prepoznaje uopste html dokument, kada se nudi sta da konvertujem.

a nista bne pokazuje kao gresku, samo ne mogu da nadjem snimljen file
 
Odgovor na temu

bokinet

Član broj: 29844
Poruke: 574



+50 Profil

icon Re: konvertovanje vise html-a u vise word dokumenta09.09.2018. u 15:05 - pre 67 meseci
Uzorci html-a koji se konvertuju ne bi bilo lose da se priloze kako bi se videlo i ispratilo sve sta se hoce.
 
Odgovor na temu

vojvoda1010
nezaposlen

Član broj: 310516
Poruke: 547
82.208.214.*



+2 Profil

icon Re: konvertovanje vise html-a u vise word dokumenta09.09.2018. u 15:17 - pre 67 meseci
u prilogu
Prikačeni fajlovi
 
Odgovor na temu

bokinet

Član broj: 29844
Poruke: 574



+50 Profil

icon Re: konvertovanje vise html-a u vise word dokumenta09.09.2018. u 15:35 - pre 67 meseci
U prilogu je odradjen MS Word file na osnovu datog HTML file-a rucno.

Znaci konverzija je moguca.

Ako stignem i kad stignem, videcu i kod da odradim za to.

Prikačeni fajlovi
 
Odgovor na temu

vojvoda1010
nezaposlen

Član broj: 310516
Poruke: 547
82.208.214.*



+2 Profil

icon Re: konvertovanje vise html-a u vise word dokumenta10.09.2018. u 17:53 - pre 67 meseci
Sub convertToWord()
Dim MyObj As Object, MySource As Object, file As Variant
file = Dir("C:\Users\Korisnik\Desktop\PRAKSA SUDOVA\APELACIONU SUD KRAGUJEVAC\naknada stete\html\" & "*.html") 'pdf path
Do While (file <> "")
ChangeFileOpenDirectory "C:\Users\Korisnik\Desktop\PRAKSA SUDOVA\APELACIONU SUD KRAGUJEVAC\naknada stete\html\"
Documents.Open FileName:=file, ConfirmConversions:=False, ReadOnly:= _
False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:= _
"", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="", _
Format:=wdOpenFormatAuto, XMLTransform:=""
ChangeFileOpenDirectory "C:\Users\Korisnik\Desktop\PRAKSA SUDOVA\APELACIONU SUD KRAGUJEVAC\naknada stete\html\" 'path for saving word
ActiveDocument.SaveAs2 FileName:=Replace(file, ".html", ".docx"), FileFormat:=wdFormatXMLDocument _
, LockComments:=False, Password:="", AddToRecentFiles:=True, _
WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False, CompatibilityMode:=15
ActiveDocument.Close
file = Dir
Loop
End Sub




run time errorr kod CompatibilityMode:=15
 
Odgovor na temu

bokinet

Član broj: 29844
Poruke: 574



+50 Profil

icon Re: konvertovanje vise html-a u vise word dokumenta10.09.2018. u 18:01 - pre 67 meseci
Prilog fali kao file za uzorak.

Probati u kodu da se ispravi vrednost za promenljivu CompatibilityMode:=15 ili da se ista izbaci.



wdCurrent 65535 Compatibility mode equivalent to the latest version of Word.
wdWord2003 11 Word is put into a mode that is most compatible with Word 2003. Features new to Word are disabled in this mode.
wdWord2007 12 Word is put into a mode that is most compatible with Office Word 2007. Features new to Wordare disabled in this mode.
wdWord2010 14 Word is put into a mode that is most compatible with . Features new to Wordare disabled in this mode.
wdWord2013 15 Default. All Word features are enabled.
 
Odgovor na temu

bokinet

Član broj: 29844
Poruke: 574



+50 Profil

icon Re: konvertovanje vise html-a u vise word dokumenta10.09.2018. u 18:09 - pre 67 meseci
Takodje moze da se koristi SaveAs() metoda ako nisu potrebne dodatne stvari prilikom snimanja dokumenta. Videti dokumentaciju za razlike izmedju SaveAs() i SaveAs2().
 
Odgovor na temu

vojvoda1010
nezaposlen

Član broj: 310516
Poruke: 547
82.208.214.*



+2 Profil

icon Re: konvertovanje vise html-a u vise word dokumenta10.09.2018. u 21:00 - pre 67 meseci
to je to izbacio sam CompatibilityMode jer sa njim nije htelo.

jos samo ako uspem da moze da se bira odakle da snimi i gde da snimi
 
Odgovor na temu

bokinet

Član broj: 29844
Poruke: 574



+50 Profil

icon Re: konvertovanje vise html-a u vise word dokumenta10.09.2018. u 22:50 - pre 67 meseci
FileName:=file -> File koji se otvara (znaci fizicka lokacija file-a)

drugi deo je

FileName:=Replace(file, ".html", ".docx") -> Lokacija i file gde se snima.


Ja ovde ne vidim sta je sporno kad je sve jasno i cisto sto se tice lokacija i nacina upotrebe?

 
Odgovor na temu

vojvoda1010
nezaposlen

Član broj: 310516
Poruke: 547
82.208.214.*



+2 Profil

icon Re: konvertovanje vise html-a u vise word dokumenta11.09.2018. u 05:44 - pre 67 meseci
macro radi super, nego sam mislio na to kada se pokrene macro da mogu da biram folder iz koga konvertujem i folder u koji konvertujem
 
Odgovor na temu

[es] :: Office :: Word :: konvertovanje vise html-a u vise word dokumenta

Strane: 1 2

[ Pregleda: 4315 | Odgovora: 25 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.