473,668 Members | 2,654 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to save an existing file into a new file using "save as" method?

61 New Member
Hai to all,

if i'm having a file named as "tab.doc" which is a microsoft word document file ...

i want to save it as another file as "tab1.doc" by using

"save as" method....

Is there any "save as" method available for doing this process in VC++....

thanks in advance..
senthil..
Jan 10 '07 #1
8 3622
asenthil
61 New Member
Hai
can anybody help me...

i want to save the content of an existing file into a newly created file by using
the "save as" method...

for example if i'm having tab.doc which is a manually created ms word document
file...

then i want to the save the contents of tab.doc file into a new file tab1.doc. by

using "SaveFileAs " method...

How can i do it..

Can any body plzz help me..
Jan 10 '07 #2
Banfa
9,065 Recognized Expert Moderator Expert
You question is not clear, you have not described your problem in enough detail.

Why would you want to use C++ for this?
Why can't you just select Save As from the work menu?
Why can't you use copy?
What is the purpose of the program you are trying to write?
Jan 10 '07 #3
asenthil
61 New Member
Hai...

thanks for ur reply..

mainly i want to automate that process in my project...

Actually i'm a Adobe indesign plugin developer...

i'm developing indesing plugin's using VC++..

i want to import a html file into indesign document...

but indesign does not support html...

thats y i'm trying import doc file(ms word)...

ok plzz tell me how to copy the contents of one file(ie tab.doc) into the

another file(tab1.doc). ...

is there any source code available for doing this proces...

plzz help me its very urgent...

thanks...
senthil
Jan 10 '07 #4
Banfa
9,065 Recognized Expert Moderator Expert
Assuming you have access to the Windows API then I suggest you use

BOOL CopyFile(
LPCTSTR lpExistingFileN ame,
LPCTSTR lpNewFileName,
BOOL bFailIfExists
);

or

BOOL CopyFileEx(
LPCTSTR lpExistingFileN ame,
LPCTSTR lpNewFileName,
LPPROGRESS_ROUT INE lpProgressRouti ne,
LPVOID lpData,
LPBOOL pbCancel,
DWORD dwCopyFlags
);


If you don't have access to the Windows API then you will need to use functions

fopen
fclose
fread
fwrite

To open the source and destination files (in binary mode) read data from the source and write data to the destination and then close both files again.
Jan 10 '07 #5
asenthil
61 New Member
Hai Banfa,

thanks for ur reply...

Itz working supervly...

But this CopyFile() method is not suitable for my project...

I want only "SaveAs" method for my project....

Can u please tell me

How to save an old file into a new fie by using "save as"...

The manual process is that...

if there is a file named 1.doc... we will open it with ms word...

then click file->save as.. button for saving the contents of 1.doc to a
new file named as 2.doc...

I want to automate this process in my program using any SaveAs() method
like CopyFile() method

is there any source code available for this process...

plzz help me...

thanks for ur reply..
senthil..
Jan 11 '07 #6
Banfa
9,065 Recognized Expert Moderator Expert
There is no such method as SaveAs.

If you open a document in Word and then "Save As" you are effectively copying it which is what CopyFile does.
Jan 11 '07 #7
asenthil
61 New Member
Hai Banfa,

thanks for ur suggestions and responses...

then otherwise...

Then plzz tell me how to save the content of webpage into an image file...

in C++...

i found that saveToFile() is available for doing that...

i found a sample code in the net also...

Expand|Select|Wrap|Line Numbers
  1. void DownloadHtml(void)
  2.     {
  3.     CkHttp http;
  4.  
  5.     CkString strHtml;
  6.     bool success = http.QuickGetStr("C:/1.html",strHtml);
  7.  
  8.     // Save the HTML to a file.
  9.     strHtml.saveToFile("1.jpg");
  10.  
  11.     }
  12.  
  13. But dont know how to use the above function in my project..
  14.  
  15. it showing errors like 
  16. 'http': identifier not found, even with argument-dependent lookup
  17. 'CkString' : undeclared identifier
  18. 'CkHttp' : undeclared
identifieri'm a beginner to c++...
i think these are only small problems...

will u plzz help me...
thanks
senthil..
Jan 11 '07 #8
Banfa
9,065 Recognized Expert Moderator Expert
That code relies on the classes CkHttp, CkString which are products of Chilkat software. If you have and are willing to spend the several $100 they cost I would suggest that you then contact Chilkat support for help in using them.

You may be able to do something with the MFC classes CHttpConnection and CHtmlView. Perhaps you can get CHtmlView to render to a jpg file instead of the screen.

Otherwise it's a case of loading the HTML (and related files, css and images for example), rendering it to an image and then saving that image in JPG format.
Jan 11 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3253
by: Francesc Guim Bernat | last post by:
Dear Colleagues, i'm developing a C++ .NET based application that works with System.Xml library. My problem appears when i try to save a document througt XmlDocument->Save method, because it seems to add some strange characters at the beginning of the saved XML document. For instance, if first i print the document throught System::Console class, the output is:
1
2450
by: Francesc Guim Bernat | last post by:
Dear Colleagues, i'm developing a C++ .NET based application that works with System.Xml library. My problem appears when i try to save a document througt XmlDocument->Save method, because it seems to add some strange characters at the beginning of the saved XML document. For instance, if first i print the document throught System::Console
15
2544
by: Bobby C. Jones | last post by:
Is there an advantage to either of these methods, or is it simply a matter of style? I used to use the "as" method, but later gave it up for the "is" method as the intent of the code seems a little clearer to me. I now have some projects coming up where the baseTypeCollection will contain 5k to 10k objects that will have to be searched for various sub types of which I only expect to find ~50 to ~100 matches. Thanks! foreach (baseType...
4
5541
by: Richard | last post by:
Hi I'm new to ASP/Web programming so any help would be appreciated... Situation: On my web page I would like to present a link {or button} that would allow the user to download a large file. When the user clicks to start the download I would like to display the "Save As" dialog, allow the user to name a place to save the file, and then show the download progress bar while the file downloads Question: How do I make a windows "Save...
5
1877
by: Paul Sullivan | last post by:
We are a state agency that views protected medical information via our intranet. The screens even have privacy shields. Alarmingly, uses can "Print" and "Save As" which destroys the protection of the health information at the level we want. QUESTION: Can we shut those off?? Any other suggestions?? Paul Sullivan
3
2542
by: B-Dog | last post by:
I'm checking some files to see if the filenames are in a certain format and if not I want to pull up a dialog box that gives me a save as with the file that is in question. I have all the files in a certain directory and if it doesn't meet my criteria then I want to do a "save as" to a different location. How can I do that. I can't seem to get the save as dialog to grab the filename of the file in question and ask for a place to save it....
5
2006
by: Dave | last post by:
What is the benefit of using "as" vs the other? HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("http://www.contoso.com/"); vs. HttpWebRequest myReq = WebRequest.Create("http://www.contoso.com/") as HttpWebRequest;
1
4142
by: kurtrips | last post by:
I am trying to use M$'s XMLDOM's save method but it is doing absolutely nothing. xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async=false; xmlDoc.load("bestscores.xml"); xmlDoc.save('123.xml'); (The code is in Javascript.) I've tried relative paths/absolute paths/all sorts of permutations, but
1
7927
by: suitland | last post by:
Hi All, I am using the execCommand(SaveAs) function to save an HTML file as an xls file, and works fine when I open the program and open the file. Is there anyway I can trigger an Open dialog box asking if the user wants to open the file after the file finished downloading?
0
8381
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8893
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8797
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8656
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7401
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6209
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5681
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4205
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2791
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.