The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Image export settings - setting DPI does not work
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

additive

Germany
109 Posts

Posted - 06/23/2009 :  2:05:09 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro 8.0 SR4
Windows XP

Hi,
I've already spent hours to figure out how to export a graph to EMF format using the required DPI size (via OC of course).

export_page_to_image()
seems to regard the DPI parameter only for bitmap files.

Saving the dialog settings to an OIS theme file and loading it via
theme_load_settings(trExportSettings, strPath);

and then running
export_page( pg, strFileName, trSettings);

causes "unattached wrapper class members" ...

I've looked into GraphicalExport.c but couln't find anything helpful ..

Anyone experienced in graph export settings? Thank you for sharing any piece of advice!

-Michael


easwar

USA
1964 Posts

Posted - 06/24/2009 :  12:25:30 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Michael,

For EMF export, which is a vector type, DPI setting does not apply....one should be able to set the Width or Height of the export, and then the receiving application (such as Word) uses that info to render the image to have the set width/height.

This works correctly with WMF (from the expgraph XF dialog), I can set say width to be 2 inches, and when placed in Word i get an image that is exactly 2 inches.

The above (from GUI) does not work for EMF, so there appears to be a bug/issue with setting size with EMF, this is trackered as QA#13843 and we are looking into this issue.

I did not test from OC, but it is possible OC-width-settings for EMF are also being ignored/not set, as the expGraph tool uses OC to do the export.

Easwar
OriginLab
Go to Top of Page

additive

Germany
109 Posts

Posted - 06/24/2009 :  4:24:16 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Easwar,
thank you for your quick response!

quote:
Originally posted by easwar
For EMF export, which is a vector type, DPI setting does not apply....one should be able to set the Width or Height of the export, and then the receiving application (such as Word) uses that info to render the image to have the set width/height.


I know this but I figured out that using the dialog from the file menu (export graph) the DPI setting results in different 1:1 representations in other applications. So in general Origin indeed seems to be able to export properly. That's why I tried to use the OIS settings as a workaround. Maybe you can have a look into this direction?

Unfortunately, I'm not able to set the dimensions at the output destination. I'm trying to include graph pages into flexGrid cells, which works pretty well for bitmaps, but EMF files are displayed so huge that one can see only some letters of the axis label.


	PictureHolder pictHolder;	
	HENHMETAFILE hEMF = load_enhanced_metafile(strEMFPath); 
	pictHolder.CreateFromEnhMetafile(hEMF, true);
	bool bRet = SetCellPicture(nCol, nRow, pictHolder);	

and using

bool CFlexGridWrapperBOR::SetCellPicture(int nCol, int nRow, PictureHolder &pict)
{
	_VARIANT vtPic;
	vtPic = pict;
	m_oFlexGrid.Cell(flexcpPicture, nRow, nCol) = vtPic;
	return TRUE;
}

Unfortunately, only PictureControl objects can be scaled to fit their placeholder.

A (working) direct attach method would be even nicer:

bool CFlexGridWrapperBOR::SetCellEMF(int nCol, int nRow, GraphPage gp)
{
	PictureHolder pictHolder;
	page_get_picture(gp, pictHolder, "EMF", 72, false);
	bool bRet = SetCellPicture(nCol, nRow, pictHolder);	
	return bRet;
}


Browsing OriginLabs' code I've found so many different export and attach methods, so I still hope one of them could be useful for this purpose ...

Michael

Go to Top of Page

Iris_Bai

China
Posts

Posted - 06/24/2009 :  11:02:01 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Michael,

You can use the following codes to format flex grid to show whole picture in one cell.


m_oFlexGrid.Cell(flexcpPictureAlignment, nRow, nCol) = flexPicAlignStretch; // to show whole graph

// set row height with the original ratio
int nPictureHeight = 2463; //pixel
int nPictureWidth  = 3216; //pixel
double dAspectRatio = (double) nPictureHeight / nPictureWidth;

RECT rect; 
GetCellRect(nRow, nCol, rect);
int ny = PixelsToTwips((rect.right - rect.left) * dAspectRatio);
m_oFlexGrid.RowHeight(nRow) = ny;			


Iris
Go to Top of Page

additive

Germany
109 Posts

Posted - 06/25/2009 :  02:41:14 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hey, this is really great!
Thank you very much!
I've already used the picture alignment parameter, but since I was focused on top alignment I overlooked this setting. Works perfect now! Once again, thanks for your quick response!

-Michael
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000