|
-
May 25th, 2022, 04:31 PM
#5
Re: Contact from VS C++ to Excel VBA
I found a solution which is much, much easier than what your links put me into.
Going to the links you offered I was shocked at the complexity involved when this excel automation philosophy was involved.
And my intention was to print a WinForm, not an excel sheet. The excel files serve as a database.
When my client is satisfied with this I'll see how that complex philosophy really works.
Code:
System::Void BhMainForm::pbPrint_Click(System::Object^ sender, System::EventArgs^ e) {
Graphics^ myGraphics = BhMainForm::CreateGraphics();
System::Drawing::Size size = this->Size;
BhMainForm::memoryImage = gcnew Bitmap(size.Width, size.Height, myGraphics);
Graphics^ memoryGraphics = myGraphics->FromImage(memoryImage);
int locX = this->Location.X + 220;
int locY = this->Location.Y + 28;
size.Width = size.Width - 225;
size.Height = size.Height - 32;
memoryGraphics->CopyFromScreen(locX, locY, 0, 0, size);
printDocument1->DefaultPageSettings->Landscape = true;
printDocument1->Print();
} // System::Void BhMainForm::pbPrint_Click(System::Object^ sender, System::EventArgs^ e)
Klatau Broada Nektau
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|