|
Is the header file a C# file because that code will not compile, C# seems to only allow you to define symbols and not the C style macro replacements.
I'm guessing that that header file is for another part of the project written in C++ or another language and you want to use that header file to define the assembly version of the C# project, am I correct?
I just tried something like this: [assembly: AssemblyVersion(System.IO.File.ReadAllText(@"temp.txt"))] to see if you could write a static class that would parse the header file but it returns this compile error: An attribute argument must be a constant expression, typeof expression or array creation expression.
So it looks as if you can't do it directly in C#.
The only possibility that I can think of is if you create a small program which parses your header file to extract the version information and then inserts this into the AssemblyInfo.cs file and run this program as a pre-build event.
Hope that's of some help.
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
Hi Ed,
ok, it seems, that there is not an easy way to use this header file in c# project. You are right, the header is from c++ and it is used for all other c/c++ projects. My colleague gave me already an advice how to solve this : I have to make an managed c++ project, which will have just one class and will include this header file. And this c++ project will be used in the c# project...
So far thank you. Ragards Daniel
|
|
|
|
|
That won't change the version number, unless you write the C# project in the C++ project, which would mean that it's not a C# project . I.e. the C++ project would have it's own assembly versiona and the C# would have a different version. (Since VS.NET does not support projects containing, for example C# and VB code or C# and C++ code, you have to seperate them into different projects).
I'm pretty sure of that anyway.
If the other suggested method works then use it but I still think that writing a simple parser would be more flexible, reliable and a better use on resources. (It could even be done in a Batch file but since you've got .NET on the development machine then it'd be simpler to write a .NET executable).
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
Ed.Poore wrote: (Since VS.NET does not support projects containing, for example C# and VB code or C# and C++ code, you have to seperate them into different projects).
Apparently (in VS 2005) you can have C# and C++ in the same project - provided that the base project is C++. No idea how you do this though!
Kevin
|
|
|
|
|
In the .net 2005 it is possible to have a c++ and c# projects in one solution . But to write .net exe and run it in the pre-build event is probably a better idea. I will try both. Regards Daniel
|
|
|
|
|
Daniel Dusek wrote: In the .net 2005 it is possible to have a c++ and c# projects in one solution
Did you mean to say C++ and C# code in one project?
Kevin
|
|
|
|
|
you can just run it through the VC preprocessor, just make sure you dont have other funny stuff in the file, particularly region directives.
cl -E ... what the heck, I feel friendly today
<FONT color=Blue>using</FONT> System;
<FONT color=Blue>using</FONT> System<FONT color=DarkBlue>.</FONT>IO;
<FONT color=Blue>using</FONT> System<FONT color=DarkBlue>.</FONT>Diagnostics;
<FONT color=Blue>using</FONT> System<FONT color=DarkBlue>.</FONT>Text<FONT color=DarkBlue>.</FONT>RegularExpressions;
<FONT color=Blue>namespace</FONT> xacc<FONT color=DarkBlue>.</FONT>cspp
{
<FONT color=Blue>class</FONT> cspp
{
[STAThread]
<FONT color=Blue>static void</FONT> Main<FONT color=DarkBlue>(</FONT><FONT color=Blue>string</FONT><FONT color=DarkBlue>[]</FONT> args<FONT color=DarkBlue>)</FONT>
{
<FONT color=Blue>try</FONT>
{
Process pp = <FONT color=Blue>new</FONT> Process<FONT color=DarkBlue>()</FONT>;
ProcessStartInfo psi = pp<FONT color=DarkBlue>.</FONT>StartInfo;
<FONT color=Blue>string</FONT> pgfiles = Environment<FONT color=DarkBlue>.</FONT>GetFolderPath<FONT color=DarkBlue>(</FONT>Environment<FONT color=DarkBlue>.</FONT>SpecialFolder<FONT color=DarkBlue>.</FONT>ProgramFiles<FONT color=DarkBlue>)</FONT>;
psi<FONT color=DarkBlue>.</FONT>FileName = pgfiles + <FONT color=Maroon>@"\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe"</FONT>;
<FONT color=Blue>const</FONT> RegexOptions RE = RegexOptions<FONT color=DarkBlue>.</FONT>Compiled;
Regex re = <FONT color=Blue>new</FONT> Regex<FONT color=DarkBlue>(</FONT><FONT color=Maroon>@"^\s*#\s*(end)?region"</FONT>,RE<FONT color=DarkBlue>)</FONT>;
Regex re2 = <FONT color=Blue>new</FONT> Regex<FONT color=DarkBlue>(</FONT><FONT color=Maroon>@"^\s*#pragma"</FONT>,RE<FONT color=DarkBlue>)</FONT>;
Regex l = <FONT color=Blue>new</FONT> Regex<FONT color=DarkBlue>(</FONT><FONT color=Maroon>@"^#line\s(?<line>\d+)"</FONT>,RE<FONT color=DarkBlue>)</FONT>;
<FONT color=Blue>foreach</FONT> <FONT color=DarkBlue>(</FONT><FONT color=Blue>string</FONT> file <FONT color=Blue>in</FONT> args<FONT color=DarkBlue>)</FONT>
{
<FONT color=Blue>string</FONT> longfile = Path<FONT color=DarkBlue>.</FONT>GetFullPath<FONT color=DarkBlue>(</FONT>file<FONT color=DarkBlue>).</FONT>Replace<FONT color=DarkBlue>(</FONT><FONT color=Maroon>@"\"</FONT>,<FONT color=Maroon>@"\\"</FONT><FONT color=DarkBlue>)</FONT>;
<FONT color=DarkGreen>
<FONT color=Blue>string</FONT> temp1 = Path<FONT color=DarkBlue>.</FONT>ChangeExtension<FONT color=DarkBlue>(</FONT>file, <FONT color=Maroon>"c"</FONT><FONT color=DarkBlue>)</FONT>;
<FONT color=DarkGreen>
<FONT color=Blue>string</FONT> temp2 = Path<FONT color=DarkBlue>.</FONT>ChangeExtension<FONT color=DarkBlue>(</FONT>file, <FONT color=Maroon>"i"</FONT><FONT color=DarkBlue>)</FONT>;
<FONT color=DarkGreen>
<FONT color=Blue>string</FONT> outfile = Path<FONT color=DarkBlue>.</FONT>ChangeExtension<FONT color=DarkBlue>(</FONT>file, <FONT color=Maroon>"cs"</FONT><FONT color=DarkBlue>)</FONT>;
<FONT color=Blue>using</FONT> <FONT color=DarkBlue>(</FONT>TextReader r = File<FONT color=DarkBlue>.</FONT>OpenText<FONT color=DarkBlue>(</FONT>file<FONT color=DarkBlue>))</FONT>
{
<FONT color=Blue>string</FONT> line = <FONT color=Blue>null</FONT>;
<FONT color=Blue>using</FONT> <FONT color=DarkBlue>(</FONT>TextWriter w = File<FONT color=DarkBlue>.</FONT>CreateText<FONT color=DarkBlue>(</FONT>temp1<FONT color=DarkBlue>))</FONT>
{
<FONT color=Blue>while</FONT> <FONT color=DarkBlue>((</FONT>line = r<FONT color=DarkBlue>.</FONT>ReadLine<FONT color=DarkBlue>()) !=</FONT> <FONT color=Blue>null</FONT><FONT color=DarkBlue>)</FONT>
{
<FONT color=Blue>if</FONT> <FONT color=DarkBlue>(</FONT>re<FONT color=DarkBlue>.</FONT>IsMatch<FONT color=DarkBlue>(</FONT>line<FONT color=DarkBlue>))</FONT>
{
<FONT color=DarkGreen>
line = line<FONT color=DarkBlue>.</FONT>Replace<FONT color=DarkBlue>(</FONT><FONT color=Maroon>"#"</FONT>, <FONT color=Maroon>"#pragma ("</FONT><FONT color=DarkBlue>)</FONT> + <FONT color=Maroon>")"</FONT>;
}
w<FONT color=DarkBlue>.</FONT>WriteLine<FONT color=DarkBlue>(</FONT>line<FONT color=DarkBlue>)</FONT>;
}
}
}
psi<FONT color=DarkBlue>.</FONT>RedirectStandardError =
psi<FONT color=DarkBlue>.</FONT>RedirectStandardOutput =
psi<FONT color=DarkBlue>.</FONT>CreateNoWindow = <FONT color=Blue>true</FONT>;
psi<FONT color=DarkBlue>.</FONT>UseShellExecute = <FONT color=Blue>false</FONT>;
psi<FONT color=DarkBlue>.</FONT>Arguments = <FONT color=Blue>string</FONT><FONT color=DarkBlue>.</FONT>Format<FONT color=DarkBlue>(</FONT><FONT color=Maroon>"-nologo -C -P {0}"</FONT>, temp1<FONT color=DarkBlue>)</FONT>;
<FONT color=Blue>if</FONT> <FONT color=DarkBlue>(</FONT>!pp<FONT color=DarkBlue>.</FONT>Start<FONT color=DarkBlue>())</FONT>
{
Console<FONT color=DarkBlue>.</FONT>Error<FONT color=DarkBlue>.</FONT>WriteLine<FONT color=DarkBlue>(</FONT><FONT color=Maroon>"Process could not start. Exiting..."</FONT><FONT color=DarkBlue>)</FONT>;
Environment<FONT color=DarkBlue>.</FONT>Exit<FONT color=DarkBlue>(</FONT><FONT color=Red>1</FONT><FONT color=DarkBlue>)</FONT>;
<FONT color=Blue>return</FONT>;
}
<FONT color=Blue>string</FONT><FONT color=DarkBlue>[]</FONT> output = pp<FONT color=DarkBlue>.</FONT>StandardOutput<FONT color=DarkBlue>.</FONT>ReadToEnd<FONT color=DarkBlue>().</FONT>Replace<FONT color=DarkBlue>(</FONT>temp1, file<FONT color=DarkBlue>).</FONT>Split<FONT color=DarkBlue>(</FONT><FONT color=DarkOrange>'\n'</FONT><FONT color=DarkBlue>)</FONT>;
<FONT color=Blue>string</FONT><FONT color=DarkBlue>[]</FONT> errput = pp<FONT color=DarkBlue>.</FONT>StandardError<FONT color=DarkBlue>.</FONT>ReadToEnd<FONT color=DarkBlue>().</FONT>Replace<FONT color=DarkBlue>(</FONT>temp1, file<FONT color=DarkBlue>).</FONT>Split<FONT color=DarkBlue>(</FONT><FONT color=DarkOrange>'\n'</FONT><FONT color=DarkBlue>)</FONT>;
<FONT color=Blue>foreach</FONT> <FONT color=DarkBlue>(</FONT><FONT color=Blue>string</FONT> ff <FONT color=Blue>in</FONT> output<FONT color=DarkBlue>)</FONT>
{
<FONT color=Blue>string</FONT> fff = ff<FONT color=DarkBlue>.</FONT>TrimEnd<FONT color=DarkBlue>(</FONT><FONT color=DarkOrange>'\r'</FONT><FONT color=DarkBlue>)</FONT>;
<FONT color=Blue>if</FONT> <FONT color=DarkBlue>(</FONT>fff <FONT color=DarkBlue>!=</FONT> file<FONT color=DarkBlue>)</FONT>
{
Console<FONT color=DarkBlue>.</FONT>Out<FONT color=DarkBlue>.</FONT>Write<FONT color=DarkBlue>(</FONT>fff + <FONT color=DarkOrange>'\n'</FONT><FONT color=DarkBlue>)</FONT>;
}
}
<FONT color=Blue>foreach</FONT> <FONT color=DarkBlue>(</FONT><FONT color=Blue>string</FONT> ff <FONT color=Blue>in</FONT> errput<FONT color=DarkBlue>)</FONT>
{
<FONT color=Blue>string</FONT> fff = ff<FONT color=DarkBlue>.</FONT>TrimEnd<FONT color=DarkBlue>(</FONT><FONT color=DarkOrange>'\r'</FONT><FONT color=DarkBlue>)</FONT>;
<FONT color=Blue>if</FONT> <FONT color=DarkBlue>(</FONT>fff <FONT color=DarkBlue>!=</FONT> file<FONT color=DarkBlue>)</FONT>
{
Console<FONT color=DarkBlue>.</FONT>Error<FONT color=DarkBlue>.</FONT>Write<FONT color=DarkBlue>(</FONT>fff + <FONT color=DarkOrange>'\n'</FONT><FONT color=DarkBlue>)</FONT>;
}
}
pp<FONT color=DarkBlue>.</FONT>WaitForExit<FONT color=DarkBlue>()</FONT>;
<FONT color=Blue>if</FONT> <FONT color=DarkBlue>(</FONT>pp<FONT color=DarkBlue>.</FONT>ExitCode > <FONT color=Red>0</FONT><FONT color=DarkBlue>)</FONT>
{
File<FONT color=DarkBlue>.</FONT>Delete<FONT color=DarkBlue>(</FONT>temp1<FONT color=DarkBlue>)</FONT>;
File<FONT color=DarkBlue>.</FONT>Delete<FONT color=DarkBlue>(</FONT>temp2<FONT color=DarkBlue>)</FONT>;
Environment<FONT color=DarkBlue>.</FONT>Exit<FONT color=DarkBlue>(</FONT>pp<FONT color=DarkBlue>.</FONT>ExitCode<FONT color=DarkBlue>)</FONT>;
<FONT color=Blue>return</FONT>;
}
<FONT color=Blue>using</FONT> <FONT color=DarkBlue>(</FONT>TextReader r = File<FONT color=DarkBlue>.</FONT>OpenText<FONT color=DarkBlue>(</FONT>temp2<FONT color=DarkBlue>))</FONT>
{
<FONT color=Blue>string</FONT> line = <FONT color=Blue>null</FONT>;
<FONT color=Blue>bool</FONT> lastlinewasempty = <FONT color=Blue>false</FONT>;
<FONT color=Blue>using</FONT> <FONT color=DarkBlue>(</FONT>TextWriter w = File<FONT color=DarkBlue>.</FONT>CreateText<FONT color=DarkBlue>(</FONT>outfile<FONT color=DarkBlue>))</FONT>
{
<FONT color=Blue>while</FONT> <FONT color=DarkBlue>((</FONT>line = r<FONT color=DarkBlue>.</FONT>ReadLine<FONT color=DarkBlue>()) !=</FONT> <FONT color=Blue>null</FONT><FONT color=DarkBlue>)</FONT>
{
<FONT color=DarkGreen>
line = line<FONT color=DarkBlue>.</FONT>Replace<FONT color=DarkBlue>(</FONT><FONT color=Maroon>"##"</FONT>,<FONT color=Blue>string</FONT><FONT color=DarkBlue>.</FONT>Empty<FONT color=DarkBlue>)</FONT>;
<FONT color=Blue>if</FONT> <FONT color=DarkBlue>(</FONT>re2<FONT color=DarkBlue>.</FONT>IsMatch<FONT color=DarkBlue>(</FONT>line<FONT color=DarkBlue>))</FONT>
{
<FONT color=DarkGreen>
<FONT color=Blue>string</FONT> oldline = line;
line = line<FONT color=DarkBlue>.</FONT>Replace<FONT color=DarkBlue>(</FONT><FONT color=Maroon>"#pragma ("</FONT>, <FONT color=Maroon>"#"</FONT><FONT color=DarkBlue>).</FONT>TrimEnd<FONT color=DarkBlue>(</FONT><FONT color=DarkOrange>')'</FONT><FONT color=DarkBlue>)</FONT>;
<FONT color=Blue>if</FONT> <FONT color=DarkBlue>(</FONT>line <FONT color=DarkBlue>==</FONT> oldline<FONT color=DarkBlue>)</FONT>
{
line = <FONT color=Blue>string</FONT><FONT color=DarkBlue>.</FONT>Empty;
<FONT color=Blue>continue</FONT>;
}
}
<FONT color=Blue>else</FONT>
<FONT color=Blue>if</FONT> <FONT color=DarkBlue>(</FONT>line<FONT color=DarkBlue>.</FONT>StartsWith<FONT color=DarkBlue>(</FONT><FONT color=Maroon>"#line"</FONT><FONT color=DarkBlue>))</FONT>
{
<FONT color=DarkGreen>
line = line<FONT color=DarkBlue>.</FONT>Replace<FONT color=DarkBlue>(</FONT>temp1, longfile<FONT color=DarkBlue>)</FONT>;
Match m = l<FONT color=DarkBlue>.</FONT>Match<FONT color=DarkBlue>(</FONT>line<FONT color=DarkBlue>)</FONT>;
<FONT color=Blue>int</FONT> oldline = Convert<FONT color=DarkBlue>.</FONT>ToInt32<FONT color=DarkBlue>(</FONT> m<FONT color=DarkBlue>.</FONT>Groups[<FONT color=Maroon>"line"</FONT>]<FONT color=DarkBlue>.</FONT>Value<FONT color=DarkBlue>)</FONT>;
line = line<FONT color=DarkBlue>.</FONT>Replace<FONT color=DarkBlue>(</FONT><FONT color=Maroon>" "</FONT> + oldline + <FONT color=Maroon>" "</FONT>, <FONT color=Maroon>" "</FONT> + <FONT color=DarkBlue>++</FONT>oldline + <FONT color=Maroon>" "</FONT><FONT color=DarkBlue>)</FONT>;
<FONT color=Blue>continue</FONT>;
}
<FONT color=Blue>if</FONT> <FONT color=DarkBlue>(</FONT>line<FONT color=DarkBlue>.</FONT>Trim<FONT color=DarkBlue>().</FONT>Length <FONT color=DarkBlue>==</FONT> <FONT color=Red>0</FONT> <FONT color=DarkBlue>&&</FONT> lastlinewasempty<FONT color=DarkBlue>)</FONT>
{
<FONT color=Blue>continue</FONT>;
}
w<FONT color=DarkBlue>.</FONT>WriteLine<FONT color=DarkBlue>(</FONT>line<FONT color=DarkBlue>)</FONT>;
lastlinewasempty = line<FONT color=DarkBlue>.</FONT>Trim<FONT color=DarkBlue>().</FONT>Length <FONT color=DarkBlue>==</FONT> <FONT color=Red>0</FONT>;
}
}
}
File<FONT color=DarkBlue>.</FONT>Delete<FONT color=DarkBlue>(</FONT>temp1<FONT color=DarkBlue>)</FONT>;
File<FONT color=DarkBlue>.</FONT>Delete<FONT color=DarkBlue>(</FONT>temp2<FONT color=DarkBlue>)</FONT>;
}
pp<FONT color=DarkBlue>.</FONT>Dispose<FONT color=DarkBlue>()</FONT>;
}
<FONT color=Blue>catch</FONT> <FONT color=DarkBlue>(</FONT>Exception ex<FONT color=DarkBlue>)</FONT>
{
Console<FONT color=DarkBlue>.</FONT>Error<FONT color=DarkBlue>.</FONT>WriteLine<FONT color=DarkBlue>(</FONT>ex<FONT color=DarkBlue>.</FONT>Message<FONT color=DarkBlue>)</FONT>;
Environment<FONT color=DarkBlue>.</FONT>Exit<FONT color=DarkBlue>(</FONT><FONT color=Red>1</FONT><FONT color=DarkBlue>)</FONT>;
}
}
}
}
|
|
|
|
|
Hi @all,
thank you for your support. Finaly we decided to make a 'Global Assembly Info' class. This class will be added to all c# projects (as a link), which need to use global versioning infos. This class is defined as static and has only public static constants:
internal static class ProductInformation { [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
public const String Product = "Product name...";
...}
This constants are used to modifie the assembly-versioning attributes in the particular c# AssemblyInfo.cs like this :
(using namespace of 'Global Assembly Info' class...)
[assembly: AssemblyProduct(ProductInformation.Product)]
[assembly: AssemblyFileVersion(ProductInformation.Major + "." + ProductInformation.Minor + "." + ProductInformation.SR + "." + ProductInformation.Build)]
...
The 'Global Assembly Info' class will be filled manually, and not from the 'Versioning.h' as it was planned at the beginning.
Regads Daniel
|
|
|
|
|
hi all,
i place a savefiledialog from toolbox on my form.
with a button click i want to save only 'xls files' with some value (lets say 'x') in the first 4 rows of that excel file.
how can i do this ?
help please.
thanks in advance,
bye.
ps:
saveFileDialog2.Filter = "Excel Files (*.xls)|*.xls|" + "All Files|";
saveFileDialog2.FilterIndex = 1;
saveFileDialog2.ShowDialog();
if (saveFileDialog2.ShowDialog() == DialogResult.OK)
{
MessageBox.Show("The Save button was clicked or the Enter key was pressed" +
"\nThe file would have been saved as " +
saveFileDialog2.FileName);
}
else
MessageBox.Show("The Cancel button was clicked or Esc was pressed");
> what else should i add the code above to be able to save a document ?
> i have to double click on 'save' button to close savedialog. why? how can i do that with one click ?
-- modified at 8:16 Monday 5th June, 2006
|
|
|
|
|
Mehmet Fatih Akbulut wrote: how can i do that with one click ?
It should be one click, try changing
Mehmet Fatih Akbulut wrote: saveFileDialog2.ShowDialog()
to saveFileDialog2.ShowDialog(this)
Which shows the dialog box as a modal child of the current form, it might be that or you may have to make sure that Main in your project has an STAThread attribute applied to it (if you forget this I know that the FolderBrowserDialog does wierd things, maybe the SaveFileDialog class is the same).
Regarding the saving of Excel files you'll need a component or class that can read and write Excel files (you could use the COM Excel component or use a managed one such as Aspose.Excel[^] but you'll have to buy that I think.
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
Message Closed
modified 27-Apr-15 11:12am.
|
|
|
|
|
[STAThread]
static void Main()
|
|
|
|
|
hi all,
i have a datagridview view with 4 columns. (2 int32 and 2 double fields)
at bottom i want to add a new row and type 'TOTAL' in 1th and 3rd columns.
(2nd and 4th columns will contain total values.)
but since 1st and 2rd columns are int32 type, i cant insert some string ('TOTAL') in them.
is there a way to do this ?
help please ...
-- modified at 6:36 Monday 5th June, 2006
|
|
|
|
|
try using footers... i didnt test the solution.
rsankarindia
|
|
|
|
|
I want to add a reference to a dll created by vb6 but it always raise the following error when i try to add it:
this is not a valid assembly or com component. only assemblies with extension 'dll' and com components can be referenced. please make sure of that the file is accessible, and that it is a valid assembly or com component.
can you help ?
-- modified at 6:28 Monday 5th June, 2006
|
|
|
|
|
You can only add references to .NET assemblies. If you want to add a reference, you need to either write a Managed C++ wrapper around the VB6 dll or make the VB6 DLL a COM component.
In case you didn't know, you can always use P/Invoke to call functions in DLLs without referencing them when compiling. If you are calling only a few functions in the DLL, I'd suggest you use P/Invoke, as it is much simpler, especially if the functions don't pass around any complex data structures.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I want to use only 4 methods from this DLL. I think it is better for me to use P/Invoke. but could you plz send an example for P/Invoke ?
|
|
|
|
|
This is a code sample copied from pinvoke.net[^] for the standard MessageBox Win32 API function.
class XYZ
{
...
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern uint MessageBox(IntPtr hWnd, String text, String caption, uint type);
}
You can then use MessageBox just like any other static function in that class (XYZ.MessageBox(...) )
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
How can add property in TextBox, i have create a class it inherits from the textbox class.
public class Status: TextBox
{
private string _status;
private int _id;
//
// costruttore
//
public void ChangeStatus(int id, string sStatus)
{
_id = id;
_status = sStatus;
}
//
// costruttore
//
public void ChangeStatus(string sStatus)
{
_status = sStatus;
}
public string sStatus
{
get
{
return _status;
}
set
{
_status = value;
}
}
}
pietro.zizzo@gmail.com
|
|
|
|
|
Well, you've added a property to Status yourself, what exactly are you trying to do?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I have a pratical example for my application. I'm at the first notion of C#.
Pietro Zizzo
pietro.zizzo@gmail.com
|
|
|
|
|
Hello All,
I am writing a console based application using C# in which I want to implement a feature which could extract OLE objects from Word documents and then save it in DWG file format. The OLE objects exist in Word documents are in the form of AutoCAD Drawing i.e. once I double clicked the Object; the system opens it in AutoCAD.
Currently I have accessed the OLE object through “Word.InlineShape” object by using Word Interop API but couldn’t find any way to save it in AutoCAD supported DWG file format. Does any one have any idea how can I obtain a DWG file through the OLE object?
Although I have extracted the OLE object in a BMP file by using “Selection.EnhMetaFileBits” property but the requirement is to be saved in DWG file format. I’ll be grateful if any one could help.
Thanks in advance!
-Shehzad
|
|
|
|
|
Good day all
I would like to access a file and change its contents. how do i go about doing this. Please help
Kulile --- RSA
|
|
|
|
|
u can try
TextReader rd = new StreamReader("complete path of file to read");
string str = rd.ReadLine();
rahul
|
|
|
|
|
Use the File.Open method with FileAccess.ReadWrite.
---
b { font-weight: normal; }
|
|
|
|