|
you may get the hidden processes (windows services) by using:
ServiceController[] services = ServiceController.GetServices();
Calin
|
|
|
|
|
Hi all,
I need to split a SELECT QUERY fom a database (which i put in a DataTable) from this:
DataTable1
0
1
2
3
4
5
6
7
8
9
10
0
1
2
3
4
5
6
7
8
9
10
0
1
2
3
0
1
2
0
1
To this:
DataTable1
0
1
2
3
4
5
6
7
8
9
10
DataTable2
0
1
2
3
4
5
6
7
8
9
10
DataTable3
0
1
2
3
DataTable4
0
1
2
DataTable5
0
1
How can i do that?? 
|
|
|
|
|
It's less that 4 hours since you last asked this question.[^]
Was there something wrong with the coded example you were given there? Maybe you should try solving the problem yourself first, rather than expecting someone else to do it all for you?
It definitely isn't definatley
|
|
|
|
|
Hello,
How we can transform a Excel file to PDF?
thank you verry mutch.
|
|
|
|
|
|
Thank you verry mutch, but i need to transform an excel file and not a htm file, help me please, thank you verry mutch.
modified on Thursday, February 26, 2009 8:32 AM
|
|
|
|
|
You can write to a pdf file, even add images using PDFSharp:
<br />
XGraphics gfx2 = XGraphics.FromPdfPage(page2);<br />
gfx2.DrawRectangle(XPens.Black, XBrushes.LightGray, new XRect(40, 310, 500, 40));<br />
gfx2.DrawImage(XImage.FromFile(@"C:\image1.jpg"), new XRect(30, 30, 100, 107));<br />
<br />
But to graft an Excel file in a pdf! I have not found how to do, help me please, thank you very much
|
|
|
|
|
|
 Thank you verry mutch for your help, i do like this :
<br />
static void Main(string[] args)<br />
{<br />
ApplicationClass excelApplication = new ApplicationClass();<br />
Workbook excelWorkBook = null;<br />
<br />
<br />
<br />
string paramSourceBookPath = @"C:\2.xlsx";<br />
object paramMissing = Type.Missing;<br />
<br />
string paramExportFilePath = @"C:\test.pdf";<br />
XlFixedFormatType paramExportFormat = XlFixedFormatType.xlTypePDF;<br />
XlFixedFormatQuality paramExportQuality =<br />
XlFixedFormatQuality.xlQualityStandard;<br />
bool paramOpenAfterPublish = false;<br />
bool paramIncludeDocProps = true;<br />
bool paramIgnorePrintAreas = true;<br />
object paramFromPage = Type.Missing;<br />
object paramToPage = Type.Missing;<br />
<br />
<br />
<br />
try<br />
{<br />
excelWorkBook = excelApplication.Workbooks.Open(paramSourceBookPath,<br />
paramMissing, paramMissing, paramMissing, paramMissing,<br />
paramMissing, paramMissing, paramMissing, paramMissing,<br />
paramMissing, paramMissing, paramMissing, paramMissing,<br />
paramMissing, paramMissing);<br />
<br />
if (excelWorkBook != null)<br />
excelWorkBook.ExportAsFixedFormat(paramExportFormat,<br />
paramExportFilePath, paramExportQuality,<br />
paramIncludeDocProps, paramIgnorePrintAreas, paramFromPage,<br />
paramToPage, paramOpenAfterPublish,<br />
paramMissing);<br />
}<br />
catch (Exception ex)<br />
{<br />
Console.WriteLine(ex.ToString());<br />
}<br />
finally<br />
{<br />
if (excelWorkBook != null)<br />
{<br />
excelWorkBook.Close(false, paramMissing, paramMissing);<br />
excelWorkBook = null;<br />
}<br />
<br />
if (excelApplication != null)<br />
{<br />
excelApplication.Quit();<br />
excelApplication = null;<br />
}<br />
<br />
GC.Collect();<br />
GC.WaitForPendingFinalizers();<br />
GC.Collect();<br />
GC.WaitForPendingFinalizers();<br />
} <br />
<br />
<br />
}<br />
But unfortunately, it doesn't work, help me please, thank you verry mutch.
|
|
|
|
|
|
the error was:
System.ArgumentException: The value is not within the range expected.
à Microsoft.Office.Interop.Excel.WorkbookClass.ExportAsFixedFormat(XlFixedFormatType Type, Object Filename, Object Quality, Object IncludeDocProperties, Object IgnorePrintAreas, Object From, Object To, Object OpenAfterPublish, Object FixedFormatExtClassPtr)
à Excel_to_Pdf.Form1.Form1_Load(Object sender, EventArgs e) dans C:\Documents and Settings\Administrateur\Mes documents\Visual Studio 2005\Projects\Excel_to_Pdf\Excel_to_Pdf\Form1.cs:ligne 53.
Thank you verry mutch
|
|
|
|
|
|
thank you verry mutch,it work for a xlsx file,but unfortunatelly not for xsl file, how i can resolve this problem? thank you verry mutch.
|
|
|
|
|
I tried your code with a xls file and it appears to work. It was an xls made with Excel 2007, though...
As usual, what is the error?
|
|
|
|
|
the error was :
System.Runtime.InteropServices.COMException (0x800A03EC): Exception de HRESULT : 0x800A03EC
à Microsoft.Office.Interop.Excel.WorkbookClass.ExportAsFixedFormat(XlFixedFormatType Type, Object Filename, Object Quality, Object IncludeDocProperties, Object IgnorePrintAreas, Object From, Object To, Object OpenAfterPublish, Object FixedFormatExtClassPtr)
à Excel_to_Pdf.Form1.Form1_Load(Object sender, EventArgs e) dans C:\Documents and Settings\Administrateur\Mes documents\Visual Studio 2005\Projects\Excel_to_Pdf\Excel_to_Pdf\Form1.cs:ligne 68
Thnak you verry mutch.
|
|
|
|
|
No clue, sorry.
Try to search the error "System.Runtime.InteropServices.COMException (0x800A03EC): Exception from HRESULT : 0x800A03EC" in Google, hopefully someone already encountered (and solved) this error.
|
|
|
|
|
I don't find the solution, i think that it must be transformed on XSLX, but how we can transform xsl to xslx with c#? thank you verry mutch.
|
|
|
|
|
As I said, in my machine your code worked with an XSL, so maybe the problem is related to the document you are using.
Anyway, you can save an XLSX as XLS by using the SaveAs method on the workbook object and specifying XlFileFormat.xlWorkbookNormal as file format.
|
|
|
|
|
i make this?
excelWorkBook.ExportAsFixedFormat(paramExportFormat,<br />
paramExportFilePath, paramExportQuality,<br />
paramIncludeDocProps, paramIgnorePrintAreas, paramFromPage,<br />
paramToPage, paramOpenAfterPublish,<br />
XlFileFormat.xlWorkbookNormal);
but i does not work, help me please, thank you verry mutch.
|
|
|
|
|
i have often this error on message box :
Document not saved. The document may be open or an error occurred while recording.
in this code :
<br />
if (excelWorkBook != null)<br />
excelWorkBook.ExportAsFixedFormat(paramExportFormat,<br />
paramExportFilePath, paramExportQuality,<br />
paramIncludeDocProps, paramIgnorePrintAreas, paramFromPage,<br />
paramToPage, paramOpenAfterPublish,<br />
paramMissing);<br />
I am sur that the file was not open,
thank you verry mutch.
|
|
|
|
|
thank you verry mutch, so can i apply this code for a word file??
|
|
|
|
|
Hi
I have console application that contain sub project define as dll,
I would like to add XML to the dll so the when I deliver the dll it already contain the xml without sending dll and xml separately
How can I add it?
Should I just select add item and then select the XML file?
Thanks
Ronen
|
|
|
|
|
Add it as a linked resource to the dll which you are sending.
In Visual studio you can easily add a linked resource by going to project properties / Resources button. Click on the top first dropsown button to change ti to files and then you can easily add.
|
|
|
|
|
Hi All,
I am currently trying to figure out how the [assembly: AssemblyVersion("1.0.0.*")] works. In particular the * part of it. I understand about the Major Number, Minor Number and Build Number. What I don't understand is the Revision Number.
As it is * it automatically increments... however; what determines the revision number. I.e. where does it come from?
If anyone knows, I'd appreciate your thoughts,
Thanks

|
|
|
|
|
It is nothing but the number of Build action. I suppose.
|
|
|
|
|