I search that subject about during 3 mounth and I already watch and read almost every document on internet at the and ı saw your video Thank you so so much
i face this error .. please help me to fix this... Error 1 'object' does not contain a definition for 'Value' and no extension method 'Value' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) C:\Users\Rinku Kaushik\Documents\Visual Studio 2010\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs 45 38 WindowsFormsApplication1
Hi sir, the video is really well explained, but I've got a question, basically I've managed to create a report with the code provided by you, but now I've got another part of the same report in another form page, just to simplify for the user, how do i "link" them both together in one word file report?
I face this error.. kindly help me to fix it. Error 1 'object' does not contain a definition for 'Value' and no extension method 'Value' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) C:\Users\Rinku Kaushik\Documents\Visual Studio 2010\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs 45 38 WindowsFormsApplication1
Hey there, I am trying to run this on a contract document that I didn't make, but am trying to make a program that generates contracts based on this document as a template. For some reason it's not replacing everything, among the things that refuse to change are the title and subtitle on the cover page, and some lines in a footer which is inside of a shape or a textbox of some sort. Why are these instances refusing to change with the search replace?
After I generated the .docx it wont let me see anything, I can open it but its just blank, not plain worksheet but plain word application nothing inside. Any suggestions?
I tried at different PCs' and their words from 1) LTSC Professional Plus 2021 2) Word 2007 tried both docx and doc format 4 times, the error is same at wordApp.Selection.Find.Execute() function System.Runtime.InteropServices.COMException: Type mismatch 0x80020005 (DISP_E_TYPEMISMATCH) any solution or opinion that may help me?
@@Madsycode Wow man, thank you. You're still replying after 4 years. Anyway, I couldn't find a decent solution for that and used a nuget called "Spire". It was enough for me.
@@why-fu5979 everything has worked, suddenly it just broke, even if I download the code from scratch again, it still not working… Could there be an reference or something i’m missing suddenly?
I got a warning saying "Could not resolve this reference. Could not locate the assembly "Bunifu_UI_v1.52". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.'' and "The referenced component 'Bunifu_UI_v1.52' could not be found." and when i run it go to else loop and pop up say "File not Found!" do anyone know why?
@@Madsycode It worked after I deleted the print button thank you. your video are very helpful. and Just a friendly feedback try to sound little more enthusiastic. with such great content, you channel will shine on TH-cam
Hola, perdón si hablo español, solo tengo una pregunta, quiero guardar información en archivos de Word mediante C# y guardarla, para que después mi programa lea esa información y la muestre..... espero tu respuesta gracias.
Hello, sorry if I speak Spanish, I only have one question, I want to save information in Word files by C # and save it, so that after my program read that information and show it ..... I wait for your answer thanks.
Hi can you please assist with the error. Severity Code Description Project File Line Suppression State Error CS1061 'CriarNovo' does not contain a definition for 'FindAndReplace' and no extension method 'FindAndReplace' accepting a first argument of type '
HI! Great thanks for this video, it helped me a lot and was my support to generate a word document :) One question: can we do modifications in the header or footer of the word template document?
I used this tutorial to help me create (N) number of files for shareholder reports. I am noticing that it runs very slow. It takes 3 min to create only 26 files. The datatable populates almost instantly with results of the stored procedure but the actual creating of each file takes a lot of time. Is there any way to improve speed? There could be instances where we need to create 1000 customized reports. Thank you for this tutorial and thank you in advance for your help with my question.
@@Madsycode I want to explain through on your work. I want to prepare 3 form. In the firs form, it will have only the name textbox, in the second form, only the surname textbox and in the 3rd form only the date of birth textbox. In the 3rd form, there is also a generate button like yo did. when I click on generate button, it will run the template your certiface document completely. Thank you so much.
From 2018, I will still ask my question just incase someone the comments finds question. First thank for the code. Limitation I have is the save as function. Is there a way I can modify the code so that I can be saving with new name every time in situations that I want to create multiple word documents. E.g. Document 1, Document 2, Document 3 etc? thanks in advance.
Great video. Two questions: (1) Why call everything an object e.g. filename? Why not call it a string? Also, could you use the @"" to create a literal string without the escape characters?
Amazing Video, thank you so much. it is worth noticing however than this will work with .Net framework. I tried it in .Net Core and it didn't work since the package is not compatible with this version of .Net
Awesome stuff. Keep it up! Thank you so much. Can you make a tutorial on how to set continuous Line Numbers in an existing word document using Microsoft.Office.Interop.Word ? I am in search of this kindly help me in this regard I'll be very thankful to you.
Super Video! Wie kann ich den Button alle ersetzen nutzen? Ich habe einen Suchtext im Dokument und einen im Header. Alles was ich bisher im Netz gefunden habe, funktioniert nicht. Es wird immer nur der Text im Dokument geändert. Wenn ich im Word Dokument das manuell anwende, werden aber alle Suchtexte geändert. Theoretisch sollte es ja mit der Funktion hier gehen: docs.microsoft.com/de-de/visualstudio/vsto/how-to-programmatically-search-for-and-replace-text-in-documents?view=vs-2019
I search that subject about during 3 mounth and I already watch and read almost every document on internet at the and ı saw your video
Thank you so so much
thank you man
i was searching this for days
those are the codes for who doesnt want to write :D
private void findandreplace(word.Application wordapp, object tofindtext, object replacewithtext)
{
object matchcase = true;
object matchwholeword = true;
object matchwildcards = false;
object matchsoundlike = false;
object nmatchallforms = false;
object forward = true;
object format = false;
object matchkashida = false;
object matchdiactitics = false;
object matchalefhamza = false;
object matchcontrol = false;
object read_only = false;
object visible = true;
object replace = 2;
object wrap = 1;
wordapp.Selection.Find.Execute(ref tofindtext,
ref matchcase, ref matchwholeword, ref matchwildcards, ref matchsoundlike, ref nmatchallforms,
ref forward, ref wrap, ref format, ref replacewithtext,
ref replace, ref matchkashida, ref matchdiactitics, ref matchalefhamza, ref matchcontrol);
}
private void createworddocument(object filename,object saveas)
{
word.Application wordapp = new word.Application();
object missing = Missing.Value;
word.Document myworddoc = null;
if (File.Exists((string)filename))
{
object readOnly= false;
object isvisible = false;
wordapp.Visible = false;
myworddoc = wordapp.Documents.Open(ref filename, ref missing, ref readOnly, ref missing, ref missing, ref missing
, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing
, ref missing, ref missing);
myworddoc.Activate();
this.findandreplace(wordapp, "", textBox1.Text);
this.findandreplace(wordapp, "", textBox2.Text);
}
else
{
MessageBox.Show("dosya bulunamadı");
}
myworddoc.SaveAs2(ref saveas, ref missing, ref missing, ref missing
, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing
, ref missing, ref missing, ref missing, ref missing, ref missing);
myworddoc.Close();
wordapp.Quit();
MessageBox.Show("dosya oluşturuldu");
}
Abdulhamit KOŞKULU glad to no it help someone thx
And please subscribe : )
i face this error .. please help me to fix this...
Error 1 'object' does not contain a definition for 'Value' and no extension method 'Value' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) C:\Users\Rinku Kaushik\Documents\Visual Studio 2010\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs 45 38 WindowsFormsApplication1
Hi sir, the video is really well explained, but I've got a question, basically I've managed to create a report with the code provided by you, but now I've got another part of the same report in another form page, just to simplify for the user, how do i "link" them both together in one word file report?
This is exactly what I needed. Many thanks from Ukraine!
am glad to know it helped! 😂
Це ж ж треба такий комент зустріти під цим відео)
I face this error.. kindly help me to fix it.
Error 1 'object' does not contain a definition for 'Value' and no extension method 'Value' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) C:\Users\Rinku Kaushik\Documents\Visual Studio 2010\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs 45 38 WindowsFormsApplication1
I don't get your point
Any way to save with file dialog? enable the user to select the path?
so you want n know how to save files !??
Hey there, I am trying to run this on a contract document that I didn't make, but am trying to make a program that generates contracts based on this document as a template. For some reason it's not replacing everything, among the things that refuse to change are the title and subtitle on the cover page, and some lines in a footer which is inside of a shape or a textbox of some sort. Why are these instances refusing to change with the search replace?
for those kind of component you need specify the id
but thats another stuff
Thanks for the nice video! How can I adjust the code so that the words in the header and footer can also be replaced?
After I generated the .docx it wont let me see anything, I can open it but its just blank, not plain worksheet but plain word application nothing inside. Any suggestions?
Did u try with my own code in the description
How can I replace the text with a photo? @Madsycode
Thanks for your efforts and very helpful video but I have a problem in editing header by this code
Do you have any suggestions
not sure!!! what exactly isn't wrong
Thanks for this bro! I love how you introduced the find and replace method to replace text. really saved me a lot of time.
glad to know its usefull!
I know it is kinda randomly asking but does anybody know a good website to stream new movies online?
I tried at different PCs' and their words from
1) LTSC Professional Plus 2021
2) Word 2007
tried both docx and doc format
4 times, the error is same at
wordApp.Selection.Find.Execute() function
System.Runtime.InteropServices.COMException: Type mismatch
0x80020005 (DISP_E_TYPEMISMATCH)
any solution or opinion that may help me?
Man I can help dind't have that problem!! maybe the issue might be the version of .Net u r using but am not sure!
@@Madsycode Wow man, thank you. You're still replying after 4 years. Anyway, I couldn't find a decent solution for that and used a nuget called "Spire". It was enough for me.
@@CemKutluer glad to know u found ur wat :)
Hi, does the template file is compiled in the .exe file ?
did you know when creating the .doc.. there was a NullReferenceException error.
and file not found. Previously the program worked fine.
I have the same problem, is there a fix?
@@mikkelandersen6448 I've fixed it. make sure the storage area matches the code
@@why-fu5979 everything has worked, suddenly it just broke, even if I download the code from scratch again, it still not working…
Could there be an reference or something i’m missing suddenly?
@@mikkelandersen6448 that's right, sa I just remembered I experienced the same thing. I removed all visual studio and dotnet apps. and reinstall.
@@why-fu5979 I will try reinstalling visual studio, thanks for helping👌🏻🙌🏼
I got a warning saying
"Could not resolve this reference. Could not locate the assembly "Bunifu_UI_v1.52". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.''
and
"The referenced component 'Bunifu_UI_v1.52' could not be found."
and when i run it go to else loop and pop up say "File not Found!"
do anyone know why?
you need to include reference to bunifu
@@Madsycode It worked after I deleted the print button thank you. your video are very helpful.
and
Just a friendly feedback try to sound little more enthusiastic. with such great content, you channel will shine on TH-cam
@@akilarasanvinayagam5548 thx am taking notes!
Hola, perdón si hablo español, solo tengo una pregunta, quiero guardar información en archivos de Word mediante C# y guardarla, para que después mi programa lea esa información y la muestre..... espero tu respuesta gracias.
yo no comprende espanol am sorry man 😕could you please translate it
Hello, sorry if I speak Spanish, I only have one question, I want to save information in Word files by C # and save it, so that after my program read that information and show it ..... I wait for your answer thanks.
@@HectorSaldes all you need to do ist to set the wordApp.visible = true🖕 in you code
Hi
can you please assist with the error.
Severity Code Description Project File Line Suppression State
Error CS1061 'CriarNovo' does not contain a definition for 'FindAndReplace' and no extension method 'FindAndReplace' accepting a first argument of type '
Hi check the case sensitivity and be sure that the function prototype is the same :)
Sir can you add how to replace the text in word document with an image?
this is a fantastic tutorial, now how will I go about printing this directly to my printer as soon as its generated?
HI! Great thanks for this video, it helped me a lot and was my support to generate a word document :) One question: can we do modifications in the header or footer of the word template document?
have never attempted that, but I supose it should be possible!
how to save with a different name so that the file is not replaced?
I used this tutorial to help me create (N) number of files for shareholder reports. I am noticing that it runs very slow. It takes 3 min to create only 26 files. The datatable populates almost instantly with results of the stored procedure but the actual creating of each file takes a lot of time. Is there any way to improve speed? There could be instances where we need to create 1000 customized reports. Thank you for this tutorial and thank you in advance for your help with my question.
you could use multithreats to create file while
I wonder, how we can use 2 or more forms to change the word template like you did.
what do you mean exactly!!! you mean create more field or a seperate form "?
@@Madsycode I want to explain through on your work. I want to prepare 3 form. In the firs form, it will have only the name textbox, in the second form, only the surname textbox and in the 3rd form only the date of birth textbox. In the 3rd form, there is also a generate button like yo did. when I click on generate button, it will run the template your certiface document completely. Thank you so much.
how can i use c# to change text box in word?
From 2018, I will still ask my question just incase someone the comments finds question. First thank for the code. Limitation I have is the save as function. Is there a way I can modify the code so that I can be saving with new name every time in situations that I want to create multiple word documents. E.g. Document 1, Document 2, Document 3 etc? thanks in advance.
the function saveAs could help achive that!
hi i cant declare a using word = microsoft.OFFICE.interop.wordç the OFFICE there is no OFFICE in my declaration
word = Microsoft.Office.Interop.Word
you need to check all upper- and lowercase letters. it's case sensitiv
probleme after execute they write to me
temp.docx blocked editing from user
and probleme throw in saveAs2.... help me pleas
use close() in object before saveAs()
thx!!
Is there any way to avoid the fixed pathway of the file, because the template file location is not always C:\xxx
yes of cause! or it will not be any program out there with diffrent path
Madsycode can do share an example. And it'd great if you can make a video about flexible path file
@@richaud266 check this docs.microsoft.com/de-de/dotnet/api/system.io.path.getrelativepath?view=netcore-3.1
thank you but I want to direct print this document without open file and print
Great video. Two questions: (1) Why call everything an object e.g. filename? Why not call it a string? Also, could you use the @"" to create a literal string without the escape characters?
NVM. Just saw that you did use the @"". lol
@@ElCidPhysics90 ok
Hi Madsycode,
thank you for this reference, but i seem to have issues with the function SaveAs2 i'm getting an error.
thanks man
u r welcome and thx for subscribing
but what kind of error are u getting !??
Hi
Toki Macu ,
Did you get a answer for your error of SaveAs2 ?
i Think i can help
let me know of you can !!!! thx for subscribing
@@mouadelmouzounelidrissi4489 Would love some help if you have an idea what could be wrong...
do you have the same video but to excel ?
not now but i can peek up on that
thx for subscribing 🙂
yes pls if you can , many thanks
Hi there, this is realy helpfull video, but source code link does not work. can you write link correctly
Great!! it works like a charm
yeah!! glad to know that!!
Can you please share the source code i couldn't find it in the comments
Where can I found source?
Hi Madsycode, thank you very much
glad to know it helped! thx for subscribing
word dosyasındaki resmi nasıl değiştireceğim bana yardım eder misin
Amazing Video, thank you so much. it is worth noticing however than this will work with .Net framework. I tried it in .Net Core and it didn't work since the package is not compatible with this version of .Net
thx for the info!!
Not true. I manageed to make it work on .Net Core
thanks. how to save files !??
Спасибо большое!!!
Thank you very much!!!
thx u ofr subscribing
thx a lot great video and thx for the source code
yeah you are welcome!! thx for your sub
i am facing "String parameter too long." error
not sure can it be that your string ist just allocating too much memory ?
Hi. Do you have asp.net version of this?
no sorry
can you please upload the source code again please
Thanks, Save my time :)
you are welcome!! am happy for you
what if i want to replace the data from datagridview?
Hi #Raed all you need is to get all data from the datagrid as string
value = row.Cells["Column"].Value.ToString();
Awesome stuff. Keep it up!
Thank you so much.
Can you make a tutorial on how to set continuous Line Numbers in an existing word document using Microsoft.Office.Interop.Word ?
I am in search of this kindly help me in this regard I'll be very thankful to you.
on .net core 3.1 please, MVC
any way that you hare the source code please?
check the comment of #Abdulhamit KOŞKULU he allready hare it as comment :)
Thank you very much!
you are welcome!! thx for your sub
thank you man
its helpful
glad to know that!!!! th!!! and thx for subscribing
Заебись, спасибо
thank you , but can u please send me the code source if you may please
check the commen below someone allready pull it
Thank u
ur welcome and thank u for subscribing :)
The honor is mine my friend .. but try to make your projects with code source so the viewers can download it .. just a suggestion
Super Video! Wie kann ich den Button alle ersetzen nutzen? Ich habe einen Suchtext im Dokument und einen im Header. Alles was ich bisher im Netz gefunden habe, funktioniert nicht. Es wird immer nur der Text im Dokument geändert. Wenn ich im Word Dokument das manuell anwende, werden aber alle Suchtexte geändert. Theoretisch sollte es ja mit der Funktion hier gehen: docs.microsoft.com/de-de/visualstudio/vsto/how-to-programmatically-search-for-and-replace-text-in-documents?view=vs-2019
THANKS A LOT MAN !
u r wellcome and thx for subscribing it mean alot for me
Thank you for this tutorial please I want the documentation
does not work for microsoft365
ok good to know! I think its because the file system ist different
Please can u give us the methodes code
the link on the description
Textbox ok but picture don't
am not quite sure, I get what u r talking about !!
@@Madsycode this.FindAndReplace(wordApp, "picture", picturebox.image); No get picture to word
I talk english not good
Please help me
Hey i can't find the reference :c
what reference !??
@@Madsycode The word reference. But now i got it ^^ i dont had office installed :D
great thx !!! & for you subscribe👍
thx for subscribing ☺
valla helal olsun reis :)
Great!
thx for your subscribe!!
Thanks bro.
u r welcome thx for subscribing
got it!!! :)
rubbish